Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Foxpro Form.RecordID via url to SSRS (Reporting Services)

Status
Not open for further replies.

SonicG

Technical User
Jun 9, 2011
4
US
Greetings,
First off, I have very little experience with VFP so please be kind. I've been searching for examples of passing the record id from a Foxpro form to an SSRS report that is expecting a parameter.

From the app, I call an x_ routine that builds the majority of the url where I'm trying to capture the parameter (RecordID)and append it to report string. The variable ($1) is appended to the Reporting Services url i.e. cUrl = "
RecordID syntax matches the parameter syntax in SSRS.

I'm really close as when I click on the app's report view process in the form, it starts IE with the SSRS url string displaying the example above. The report fails as it's trying to pass "$1" to the SSRS parameter, but when I change the $1 with a RecordID i.e. 190 and refresh IE, the report runs. The app routine syntax is x_htmlrpt(FORM.RecordID).

I will be able to have more specific info when I get back into the office.

Thanks in advance.
SonicG
 
Code:
...
cUrl = "[URL unfurl="true"]http://SERVER/ReportServer/Pages/ReportViewer.aspx?%2fMy+Reports%2fReport&rs:Command=Render&rs:Parameters=false&RecordID="+TRANSFOIRM(RecordId)[/URL]
...


Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
You can do as Borislav suggests and instead of adding $1 to the url simply add the recordid in string form to the url. TRANSFORM() does transform all types of values to a string representation.

If the url is predeifned with $1 you can also do string replacement, cURL = STRTRAN(cURl,"$1",Transform(RecordID)).

What you don't say is, how $1, cURL and x_htmlrpt(FORM.RecordID) are connected.

What I understand is x_htmlrpt() is creating the report URL, and it seems to ignore your paraemter and return a url with $1 instead of the id you pass in. Then you might just need to provide the record ID parameter as a string instead of a number or vice versa. What vartype is FORM.RecordID? Is it an integer value or is it a string?

Bye, Olaf.
 
Thanks for the quick response.

The RecordID is an integer in the Foxpro form.

The app allows me to link a Foxpro report to a form. How this is done, I don't know, but there is a table which holds all the variables that construct an SQL statement (formatted for Foxpro). We are pushing the envelope by trying to pass a form parameter (mainly record ID's) to an SSRS report from within the app.

I will be working on all your suggestions and I will update the thread when I have success or I'm bald.

Again, thank you for your quick response. Sonic
 
Update: This was tied tighter with the app and the way the process was to run reports. The app's report process normally builds and runs Foxpro reports.

I had to use the syntax of x_name("http......&RecordID=$1",STR(THISFORM.pnParentKey)) from the app's report function. pnParentKey appears to be specific to the app. The pnParentKey is being passed as a char, so in a nutshell,the x_code ended up as:

LPARAMETERS cURL, oValue1
LOCAL MySTATEMENT
IF VARTYPE(oValue1) = "C"
MySTATEMENT = STRTRAN(cURL,"$1",oValue1)
ENDIF

If the oValue1 was "123"
Then the final url was the "http.....&RecordID=123"

Thanks for all your help. It's much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top