Initializing Report Variables
Reporting Services 2008 R2 Visual Studio BIDS 2008 + R2 I'm trying to initialize a Report Variable with an appropriate value based on an input parameter. In the Report Variable Value expression, I placed the following code: =(Switch(Parameters!CurrencyWanted.Value = "USA",0.0, Parameters!CurrencyWanted.Value = "GBP",VAL(Variables!XRateUSD_GBP), Parameters!CurrencyWanted.Value = "EUR",VAL(Variables!XRateUSD_EUR) ) ) I tried this without the VAL expression, with DBL and CSTR coersion. All throw exceptions "Argument 'Expression' cannot be converted to type 'VariableImpl' or fail with "Report Processing" error. I found no references to the aforementioned "VariableImpl" type or how to set a Report Variable to anything except a fixed value. I tried setting the XRATE variables as strings, value literals (.633) and expressions ("=.633"). The lack of examples on MSDN or BOL is not really helping much. Yes, I plan to fetch the current exchange rates from a shared dataset in a future example but this is just an exercise to illustrate how to handle/initialize/fetch values in Report Variables. Question 2: Is the report variable a Variant? If I initialize it to "0.0" it's a string and if I initialize it to 0.0 (without the quotes) it's a double/float? And another point. Ah, does Microsoft think that its documentation is supposed to come from someone's personal blog? While Robert is a great source, IMHO this is not a substitute for in-depth documentation. Incidentally, links to the blog site are not working at this point in time. I expect this is a transitory problem but not having access to the web (like millions of developers world-wide) is a crippling disadvantage. __________________________________________________________________ William Vaughn Mentor, Consultant, Trainer, MVP http://betav.com http://betav.com/blog/billva http://www.hitchhikerguides.net “Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)” Please click the Mark as Answer button if a post solves your problem!
November 2nd, 2010 4:07pm

I'm guessing that type 'VariableImpl' is in reference to the variables class as you are referencing the variable itself rather than it's value: Maybe this will work: =(Switch(Parameters!CurrencyWanted.Value = "USA",0.0, Parameters!CurrencyWanted.Value = "GBP",VAL(Variables!XRateUSD_GBP.VALUE), Parameters!CurrencyWanted.Value = "EUR",VAL(Variables!XRateUSD_EUR.VALUE) ) ) Rgds Geoff
Free Windows Admin Tool Kit Click here and download it now
November 2nd, 2010 8:54pm

Yes, that's it. I stared at that for far too long. Thanks.__________________________________________________________________ William Vaughn Mentor, Consultant, Trainer, MVP http://betav.com http://betav.com/blog/billva http://www.hitchhikerguides.net Hitchhikers Guide to Visual Studio and SQL Server (7th Edition) Please click the Mark as Answer button if a post solves your problem!
November 3rd, 2010 12:27pm

Been there - done that!! Specifically with debugging some SSIS script where I couldn't figure out why the value I was getting returned was the name of the variable rather than its value so I recognised the issue as soon as I saw your post :-)Rgds Geoff
Free Windows Admin Tool Kit Click here and download it now
November 3rd, 2010 6:14pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics