List Variable Items

Stimulsoft Reports.WEB discussion
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

List Variable Items

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

Re: List Variable Items

Post by Alex K. »

Hello,

You can use the following expression:
{VariableList.ToQueryString()}

Thank you.
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: List Variable Items

Post by cbrydon »

Excellent Aleksey - Thank You!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: List Variable Items

Post by Alex K. »

Hello

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

Thank you.
User avatar
zalak
Posts: 18
Joined: Wed Jun 20, 2018 1:41 pm

Re: List Variable Items

Post 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
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: List Variable Items

Post by cbrydon »

Zalak,

One possibility would be to make the keys the same as the values.

Carl
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: List Variable Items

Post by Lech Kulikowski »

Hello,

Unfortunately, no. That feature is not available for variables.

There is task in our to-do list.

Thank you.
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: List Variable Items

Post 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
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: List Variable Items

Post by Lech Kulikowski »

Hello,

Thank you for the additional solution.
User avatar
zalak
Posts: 18
Joined: Wed Jun 20, 2018 1:41 pm

Re: List Variable Items

Post 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
Post Reply