Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Passing Report Parameters in URL

Author  Topic 

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 03:04:24
I am trying to pass parameters in the URL to my reports but they seem to be ignored. The parameter textboxes are not populated and no reports are generated. Is there any configuration setting on the Report Server that could prevent the reports from using my parameters (I have asked IT but no reply yet)?

Here is an example. The name of the parameter this report takes is "TestID" (the prompt is "Test ID". It is of string type (converted to integer in the query) but I have tried integer type as well. I expect the report to use my parameter if I pass it like

http://servab16/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fPerformanceIndicators%2fStruxureWare%2fUnofficial+Reports%2fStruxureWare+Defects+Linked+to+All+Instances+of+Test&TestID=18271

Should I pass the parameter in different ways depending on type? Any ideas why this does not work? It seems pretty straight-forward. Am I doing some stupid mistake?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 03:30:07
is TestID parameter mapped to a dataset for available values? If yes, values passed (in this case 18271) should be present in dataset result.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 04:00:06
No, it is not. I have not set any available values. I now tried hard-coding 18271 as an available value and passing that in the URL. Still does not work. I want to be able to provide any integer (I would be able to query for the valid IDs but I certainly do not want a drop-down with 20000+ options).
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 04:11:07
whats the data type of parameter?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 04:22:16
It is of string type but I have tried integer type as well. No difference.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 04:32:43
are you trying to pass url as is or are you generating url on the fly getting value from somewhere? if latter, can you check if value is getting passed properly?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 05:03:26
My plan is to get the TestID value from another tool and automate opening of IE, passing it as a parameter, but right now I am only trying to pass the parameter as seen above by manually entering the URL in IE (to check that it works).
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 05:32:58
Are you sure URL is correct? usually url will be of format


http://ServerName/ReportServer/Pages/ReportViewer.aspx?%Report+Folder%2fReports%2fReport+Name&rs%3aCommand=Render& color="blue">Parametername={Value}


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 07:09:10
I am sure I use the following URL to access the report without parameters:
http://servab16/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fPerformanceIndicators%2fStruxureWare%2fUnofficial+Reports%2fStruxureWare+Defects+Linked+to+All+Instances+of+Test

Adding &rs%3aCommand=Render&TestID=18271 or only one of the parameters makes no difference. Still no parameters used and no report generated.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 07:16:04
hmm..then its not issue of parameters. i think its issue with url if report is not generated even without parameters

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 07:28:26
Not sure we understand each other.

This URL always takes me to the report (if we by report mean also the textbox for the parameter) but no actual content is generated until I enter parameter value manually:
http://servab16/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fPerformanceIndicators%2fStruxureWare%2fUnofficial+Reports%2fStruxureWare+Defects+Linked+to+All+Instances+of+Test

Adding &rs%3aCommand=Render&TestID=18271 or only one of the parameters makes no difference.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 07:47:16
can you explain how you've added parameter in report (along with properties you set)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 08:07:49
In Visual Studio, after opening the report definition (.rdl), I select the "Layout" tab. I then open "Report Parameters" dialog from the main menu, click the "Add" button, set Name to "TestID", Data Type to "String" (Default) and Prompt to "Test ID". Then I just click the OK button to close the dialog, save the report definition and upload it to the server. Done.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 09:04:40
then how are you linking parameter to report?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 09:21:44
I use it in the following query:
SELECT * FROM td.BUG WHERE BG_BUG_ID IN (SELECT LN_BUG_ID FROM td.LINK WHERE LN_ENTITY_TYPE='TESTCYCL' AND LN_ENTITY_ID IN (SELECT TC_TESTCYCL_ID FROM td.TESTCYCL WHERE TC_TEST_ID=CAST(@TestID AS INT)))

Since I am able to generate my report by populating the parameter textbox manually, I suppose there is nothing wrong with how I use the parameter?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 09:47:51
ok...so thats fine. Then only other issue should be URL itself. Can you try using report viewer URL in way I posted?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-21 : 17:20:17
I already tried this without success:
http://servab16/Reports$SQL2005/Pages/Report.aspx?ItemPath=%2fPerformanceIndicators%2fStruxureWare%2fUnofficial+Reports%2fStruxureWare+Defects+Linked+to+All+Instances+of+Test&rs%3aCommand=Render&TestID=18271
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-21 : 23:27:45
can you go to Reporting Services Configuration Manager (accessed from Start->Programs->Microsoft SQL Server -> Configuration Tools) and check the URL specified there?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nasu
Yak Posting Veteran

50 Posts

Posted - 2012-12-24 : 04:27:31
Thanks a lot for your patience so far. Unfortunately, I have no access to Reporting Services Configuration Manager on the Report Server. I will try to involve IT in this. Unfortunately, this will have to wait until after Christmas and New Year's holidays.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-24 : 15:38:15
ok...no probs..let me know how you got on!

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

zung
Starting Member

1 Post

Posted - 2014-01-09 : 07:52:24
if i use stored procedures mean then how do i pass parameter from URL?
Go to Top of Page
    Next Page

- Advertisement -