Access the "value" field of a variable

Stimulsoft Ultimate discussion
Post Reply
lanfro
Posts: 24
Joined: Mon Jan 16, 2012 3:48 am
Location: Norway

Access the "value" field of a variable

Post 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
Attachments
Variable_definition.jpg
Variable_definition.jpg (58.01 KiB) Viewed 4095 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Access the "value" field of a variable

Post 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.
lanfro
Posts: 24
Joined: Mon Jan 16, 2012 3:48 am
Location: Norway

Re: Access the "value" field of a variable

Post by lanfro »

Ok, thank you for the reply! :)
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Access the "value" field of a variable

Post by Alex K. »

Hello

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

Thank you.
lanfro
Posts: 24
Joined: Mon Jan 16, 2012 3:48 am
Location: Norway

Re: Access the "value" field of a variable

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Access the "value" field of a variable

Post by Alex K. »

Hello,

Thank you for the information about the workaround.
Post Reply