Custom SQL expression

Stimulsoft Reports.WEB discussion
Post Reply
pedroalves5770
Posts: 4
Joined: Tue Apr 16, 2024 8:11 pm

Custom SQL expression

Post by pedroalves5770 »

I have a list in a report and would like to create a SQL filter condition based on that list that does the following:
Input:
TEST1, TEST2, TEST3

Output:
AND (INSTR(ds_queixa_principal, 'TEST1') > 0 OR      INSTR(ds_queixa_principal, 'TEST2') > 0 OR      INSTR(ds_queixa_principal, 'TEST3') > 0)

Is there any way to do this?
Lech Kulikowski
Posts: 7446
Joined: Tue Mar 20, 2018 5:34 am

Re: Custom SQL expression

Post by Lech Kulikowski »

Hello,

Please explain what you mean by 'input' — is it variables, a string, etc.? Does it always have 3 values, or is it dynamic?

Thank you.
pedroalves5770
Posts: 4
Joined: Tue Apr 16, 2024 8:11 pm

Re: Custom SQL expression

Post by pedroalves5770 »

My mistake! The input is a list-type variable that my user will fill in.
Lech Kulikowski
Posts: 7446
Joined: Tue Mar 20, 2018 5:34 am

Re: Custom SQL expression

Post by Lech Kulikowski »

Hello,

To use the List variable in the query, you need to use the ToQueryString() function.

Thank you.
Attachments
ListInQueryString.mrt
(9.44 KiB) Downloaded 10 times
Post Reply