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?
Custom SQL expression
-
- Posts: 4
- Joined: Tue Apr 16, 2024 8:11 pm
-
- Posts: 7446
- Joined: Tue Mar 20, 2018 5:34 am
Re: Custom SQL expression
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.
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.
-
- Posts: 4
- Joined: Tue Apr 16, 2024 8:11 pm
Re: Custom SQL expression
My mistake! The input is a list-type variable that my user will fill in.
-
- Posts: 7446
- Joined: Tue Mar 20, 2018 5:34 am
Re: Custom SQL expression
Hello,
To use the List variable in the query, you need to use the ToQueryString() function.
Thank you.
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