SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Pass Values from One parameter to another
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Amit-1234
Starting Member

India
12 Posts

Posted - 09/26/2012 :  05:25:53  Show Profile  Reply with Quote
Hi,

I have a requirement in SSRS 2008 whenever a user assigns a value to a parameter, the same value will get assigned to another Text parameter.
I have tried that using default values option in the parameter properties box, but in that case only the value which is assigned for the first time is getting assigned. New values are not getting accepted.
Kindly help.

Regards
Amit

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/26/2012 :  07:09:08  Show Profile  Reply with Quote
That should work - not sure why it is not working for you. Can you try the following exactly as I am describing? I tried this in a test report and it works as you and I are expecting it to.

In parameter properties, under Default Values, click Specify Values and Add. Click the expression button and enter =Parameters!p1.Value for the Expression Value. (p1 is the parameter whose value you want to assign to this parameter). Click Ok and run the report.
Go to Top of Page

Amit-1234
Starting Member

India
12 Posts

Posted - 09/27/2012 :  03:40:53  Show Profile  Reply with Quote
Hi,

Thanks for the help. I exactly followed the steps as mentioned and came across an observation.

I went to the preview mode and assigned the datetime parameter. Immediately the value got assigned to the desired parameter and the report got displayed. But now if i change the datetime parameter again and run the report at this time it is not working. So, I again went back to the design tab and reopened the report in preview mode and assigned another value for datetime. This time the new value is getting assigned which means that the initially assigned parmeter values are not getting refreshed or changed during report runtime. In that case the problem is if i deploy the report in web, the user has to either refresh the page manually or close and reopen the browser window everytime he wants to enter values for the second time.
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/27/2012 :  07:19:26  Show Profile  Reply with Quote
Yes, I also see the behavior you described. Do you need the parameter to be visible to the user? If that is not requirement, make the parameter internal or hidden (on the general tab of the Parameter Properties). Then it will pick up the value from the other parameter every time the report is run.

I can sort of see why Microsoft did it this way - i.e., the thinking must have been that when the user has the parameter in front of him/her and is enabled, it assumes that the user has control s/he better change it than the system trying to mess with it.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/27/2012 :  11:09:19  Show Profile  Reply with Quote
Sorry not sure if i'm missing something.
If you're linking to first parameter from second parameter by specifying it in available values section then it will change value based on what you select for first parameter
I tried creating a sample report with two parameters (param1,param2)
then set second param (param2) avaiable values tab an expression as =Parameters!param1.value

and went to preview and whatever values i picked for param1 it assigned it automatically to param2 without any refreshing

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

Go to Top of Page

Amit-1234
Starting Member

India
12 Posts

Posted - 09/28/2012 :  03:04:50  Show Profile  Reply with Quote
Actually, I also tried it using available values and it is true that the values are getting refreshed at runtime based on the value the user assigns to the first parameter.

But, there is also another problem. Suppose, I have assigned a date value in the first parameter, the values are immediately getting refreshed in the second parameter. In this case second parameter is also becoming like a drop-down box from where the user has to select the refreshed value. This will become a problem if i want to keep the second parameter as hidden.

Edited by - Amit-1234 on 09/28/2012 03:05:46
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/28/2012 :  07:01:14  Show Profile  Reply with Quote
quote:
Originally posted by Amit-1234

Actually, I also tried it using available values and it is true that the values are getting refreshed at runtime based on the value the user assigns to the first parameter.

But, there is also another problem. Suppose, I have assigned a date value in the first parameter, the values are immediately getting refreshed in the second parameter. In this case second parameter is also becoming like a drop-down box from where the user has to select the refreshed value. This will become a problem if i want to keep the second parameter as hidden.

If you make the parameter internal, it should not prompt the user to set it. In fact, if it is internal, the user has no option or ability to change it directly.
Go to Top of Page

Amit-1234
Starting Member

India
12 Posts

Posted - 09/28/2012 :  09:01:12  Show Profile  Reply with Quote
Incase of available values, the first default value is "Select a value" followed by the actual values. So if I make the parameter as hidden or internal and try to run the report it will stop the user and ask the user to fill in the value for the unseen parameter.

Is it possible in any way to directly assign the selected value in the second parameter and stopping it from becoming a combo where the default value by default is "Select a value"?

Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/28/2012 :  09:26:32  Show Profile  Reply with Quote
quote:
Originally posted by Amit-1234

Incase of available values, the first default value is "Select a value" followed by the actual values. So if I make the parameter as hidden or internal and try to run the report it will stop the user and ask the user to fill in the value for the unseen parameter.

Is it possible in any way to directly assign the selected value in the second parameter and stopping it from becoming a combo where the default value by default is "Select a value"?



Don't give any available values. Just give one default value as I described in my previous post and make the parameter internal. Seems to work correctly in whatever tests I could do.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/28/2012 :  10:38:26  Show Profile  Reply with Quote
quote:
Originally posted by Amit-1234

Incase of available values, the first default value is "Select a value" followed by the actual values. So if I make the parameter as hidden or internal and try to run the report it will stop the user and ask the user to fill in the value for the unseen parameter.

Is it possible in any way to directly assign the selected value in the second parameter and stopping it from becoming a combo where the default value by default is "Select a value"?




the reason why you set parameter value from other parameter is beacuse you dont want user to set it manually isnt it?

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

Go to Top of Page

Amit-1234
Starting Member

India
12 Posts

Posted - 09/29/2012 :  01:48:31  Show Profile  Reply with Quote
Yes, finally it worked. I used the default value option and set the parameter as internal. Its working fine now.
Thanks to all , for your valuable suggestions.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 10/01/2012 :  10:54:15  Show Profile  Reply with Quote
ok...so far as you dont want parameter to be controlled from outside you can use internal type

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

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000