Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
omid5ive
Creator II
Creator II

how store selected values from list box to variable an use it in my query?

hi

i have a problem that i think you can help me

i have a list box in my QV document and i want if i select something in this list box the value or values store in variable

i want to use this variable in my query and it should separate with comma (,) for use it in my query

how should i resolve this solution

my query is something like blow :

SELECT FB.BUL_ID

  FROM BI_USER.FACT_BILL fb

WHERE FB.F_CONSUME_TYPE IN ($(V$test))

1 Reply
Anonymous
Not applicable

Omid,

To create a variable with comma-separated values, you can define the variable in the "variables overview" using concat() function:

=concat(distinct YourField, ',')

But most likely you need to use also single quotes around the values.  In this case, add chr(39) into separator, and also start and end:

=chr(39) & concat(distinct YourField, chr(39) & ',' & chr(39)) & chr(39)

Regards,
Michael

PS: I'm not sure it is a good idea to use $ inside the variable name V$test.  Maybe it's OK, but I'd rather avoid it...