Page 1 of 1

Access the "value" field of a variable

Posted: Tue Jul 19, 2016 8:37 am
by lanfro
Hi!

Lets say a report has a variable "Variable1" as defined in the attached screenshot. The "key" field of the variable is the unique identifier of a row and the "value" field is a user friendly description text. The variable is used as a input field (user requested) to filter the report through a parameter refering to the variable "Variable1". The report has a text component on top that shows the value of "Variable1" to show the selected filter to the user. The content of the text component is: {Variable1}. However it shows the "key" value of "Variable1", which is a number and is not very user friendly. Is there a way to access the more descriptive "value" field of the variable so that the user friendly description text will show?
For instance something like {Variable1.Value()}

Regards

Frode

Re: Access the "value" field of a variable

Posted: Wed Jul 20, 2016 5:19 pm
by Alex K.
Hello,

Please send us a request on support@stimulsoft.com.
We investigate the possibility to add this feature for variables.

Thank you.

Re: Access the "value" field of a variable

Posted: Thu Jul 21, 2016 7:56 am
by lanfro
Ok, thank you for the reply! :)

Re: Access the "value" field of a variable

Posted: Thu Jul 21, 2016 8:22 am
by Alex K.
Hello

We are always glad to help you!
Let us know if you need any additional help.

Thank you.

Re: Access the "value" field of a variable

Posted: Fri Jul 22, 2016 9:09 am
by lanfro
Hi again.

Found a workaround for the problem:
1. Created a new datasource "NewDataSource" and added a SQL query with a parameter with the keyvalue of the filter variable "Variable1" (the selected value in the dropdown list). The query will return the row representing the selected value in "Variable1" from the proper database table.
2. Then for the text component showing the selected filter, the expression is set to {NewDataSource.Description}. That did the trick.

It is a little cumbersome though, but it works. Would have been more easy and elegant if the variable object just exposed a property/function like "GetValue()". Then the expression of the text component would only be {Variable1.GetValue()}.

Regards
Frode

Re: Access the "value" field of a variable

Posted: Fri Jul 22, 2016 12:41 pm
by Alex K.
Hello,

Thank you for the information about the workaround.