Page 1 of 2
List Variable Items
Posted: Fri May 12, 2017 2:37 am
by cbrydon
Hi, I have a list variable as part of a report and I'd like to be able display in a text box the value of the items in the list that have been checked on.
For example, my list variable gets its data from a database table and lists a series of Departments such as the ones listed below...
Parks
Roads
Water
Sewer
If a user only chose Parks and Water, I'd like to be able to display Parks and Water in a text box. Is there a way to determine which values in a list
variable have been checked on?
Thanks,
Carl
Re: List Variable Items
Posted: Fri May 12, 2017 8:38 am
by Alex K.
Hello,
You can use the following expression:
{VariableList.ToQueryString()}
Thank you.
Re: List Variable Items
Posted: Fri May 12, 2017 12:47 pm
by cbrydon
Excellent Aleksey - Thank You!
Re: List Variable Items
Posted: Fri May 12, 2017 1:07 pm
by Alex K.
Hello
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.
Re: List Variable Items
Posted: Thu Aug 09, 2018 7:02 am
by zalak
Hello,
Alex K. wrote: ↑Fri May 12, 2017 8:38 am
Hello,
You can use the following expression:
{VariableList.ToQueryString()}
Thank you.
In my case, the list variable has key value pair
Example:
Key: 1 Value: Vehicles
Key: 2 Value: Fruits
Key: 3 Value: Vegetables
Key: 4 Value: Electronics
Using {VariableList.ToQueryString()} it displays keys (like 2,4) instead I would like the
Values of list to be displayed (like Fruits, Electronics).
How can I display Values of the list and not keys? (I need to do it in designer)
Thanks & Regards,
Zalak
Re: List Variable Items
Posted: Thu Aug 09, 2018 11:34 am
by cbrydon
Zalak,
One possibility would be to make the keys the same as the values.
Carl
Re: List Variable Items
Posted: Thu Aug 09, 2018 8:14 pm
by Lech Kulikowski
Hello,
Unfortunately, no. That feature is not available for variables.
There is task in our to-do list.
Thank you.
Re: List Variable Items
Posted: Thu Aug 09, 2018 8:26 pm
by cbrydon
If the source for the variable was changed to Data Columns instead of Items and Zalak created a Datasource with Vehicles, Fruits, Vegetables, Electronics in a column
and then used that column for both the keys and values, it should work. I do it all the time for some of my reports.
Carl
Re: List Variable Items
Posted: Mon Aug 13, 2018 6:37 am
by Lech Kulikowski
Hello,
Thank you for the additional solution.
Re: List Variable Items
Posted: Mon Aug 13, 2018 7:31 am
by zalak
cbrydon wrote: ↑Thu Aug 09, 2018 8:26 pm
If the source for the variable was changed to Data Columns instead of Items and Zalak created a Datasource with Vehicles, Fruits, Vegetables, Electronics in a column
and then used that column for both the keys and values, it should work. I do it all the time for some of my reports.
Carl
Hello Carl,
Thank you for your reply. I had already tried with new datasource using {ID, Name} columns of datasource as {Key, Value}, but still the ToQueryString() gave me 1,2,3...
Any ways, in my case I could use IIF() statement to get the required result as the feature is not available.
Example: {IIF(Var == 1, "Vehicles", IIF(Var == 2, "Fruits", IIF(Var == 3, "Vegetables", IIF(Var == 4, "Electronics", "")))).ToString()}
I appreciate the help.
Thanks & Regards,
Zalak