How to "store" selcted items

Stimulsoft Reports.NET discussion
mighty0n3
Posts: 10
Joined: Tue Dec 05, 2023 6:23 am

How to "store" selcted items

Post by mighty0n3 »

Hello,

i have a rather simple form which contains a checked list box (name: licenses) and I want to store the selected values into a variable (Name: abc) upon click on "OK" Button in order to use the selected values in a SQL query.
How do I do that?
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: How to "store" selcted items

Post by Lech Kulikowski »

Hello,

The Form is obsolete. You can use the Request From User option for the variable, and then use this variable in the query.

Thank you.
mighty0n3
Posts: 10
Joined: Tue Dec 05, 2023 6:23 am

Re: How to "store" selcted items

Post by mighty0n3 »

Do you have some kind of example for the "Request From User option" or a "how to" so to say?
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: How to "store" selcted items

Post by Lech Kulikowski »

Hello,

Parameters category on our Demo:
https://demo.stimulsoft.com/#Net/Parame ... Categories

Thank you.
mighty0n3
Posts: 10
Joined: Tue Dec 05, 2023 6:23 am

Re: How to "store" selcted items

Post by mighty0n3 »

Ok, understood.
If i want to use the selected Values as paramter in my query it says "Cannot convert StringList to string"

Can it be worked around with an expression for example?
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: How to "store" selcted items

Post by Lech Kulikowski »

Hello,

In this case, you should use the ToQueryString() for the list variable.

Thank you.
Attachments
ListInQueryString.mrt
(7.62 KiB) Downloaded 51 times
mighty0n3
Posts: 10
Joined: Tue Dec 05, 2023 6:23 am

Re: How to "store" selcted items

Post by mighty0n3 »

If I use your example in my SQL-Query (of course with correct var-reference) results in Parse error: Syntax error

Concerning bit of SQL-Query: AND L.SkuPartNumber IN {(us_lic.Count == 0 ? "('')" : "(" + us_lic.ToQueryString("'") + ")")}
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: How to "store" selcted items

Post by Lech Kulikowski »

Hello,

If the SkuPartNumber is numeric, please try to check:
IN {(us_lic.Count == 0 ? "(0)" : "(" + us_lic.ToQueryString() + ")")}

Thank you.
mighty0n3
Posts: 10
Joined: Tue Dec 05, 2023 6:23 am

Re: How to "store" selcted items

Post by mighty0n3 »

Nope, it's a string
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: How to "store" selcted items

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data for analysis.

Thank you.
Post Reply