Page 1 of 1

Custom SQL expression

Posted: Thu Oct 02, 2025 7:15 pm
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?

Re: Custom SQL expression

Posted: Thu Oct 02, 2025 9:41 pm
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.

Re: Custom SQL expression

Posted: Fri Oct 03, 2025 5:57 pm
by pedroalves5770
My mistake! The input is a list-type variable that my user will fill in.

Re: Custom SQL expression

Posted: Fri Oct 03, 2025 10:24 pm
by Lech Kulikowski
Hello,

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

Thank you.