Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ashley55
Contributor
Contributor

Filter pane with variable input function

Hi I face a challenge to add filter variable in filter pane, I have 2 variable input vID and vCUSTNO, and when user key-in one of those 2 key, will show the customer's list in filter pane, I add function in filter pane's feild, but it nouse, how do I fix the function ?

Now , the function is 

=if(vID='',text({<[contact_now_30d.CUST_NUM]={$(vCUSTNO)}>}[contact_now_30d.Program]),text({<[contact_now_30d.custnmbr]={$(vID)}>}[contact_now_30d.Program]))
擷取.JPG

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like below

=Aggr(if(
len(trim(vID)) = 0,
text(Only({<[contact_now_30d.CUST_NUM] = {'$(vCUSTNO)'}>}[contact_now_30d.Program])),
text(Only({<[contact_now_30d.custnmbr] = {'$(vID)'}>}[contact_now_30d.Program]))
), [contact_now_30d.Program])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
jessewallick
Contributor
Contributor

Hello Maxim Time Clock@Ashley55,

 

It seems like you’re trying to create a dynamic filter pane in Qlik where the displayed list is controlled by two variables, vID and vCUSTNO. The function you’ve written should theoretically work, but if it’s not functioning as expected, there might be a syntax issue or a problem with how the variables are being used within the set analysis.

Here’s a revised version of your function that you can try:

 

=if(
len(trim(vID)) = 0,
text({<[contact_now_30d.CUST_NUM] = {$(vCUSTNO)}>}[contact_now_30d.Program]),
text({<[contact_now_30d.custnmbr] = {$(vID)}>}[contact_now_30d.Program])
)

 

This function checks if vID is empty (after trimming any whitespace), and if so, it uses vCUSTNO to filter the list. Otherwise, it uses vID. Make sure that the variables vID and vCUSTNO are defined correctly and that they are getting the expected values from the user input.

If you’re still facing issues, it could be helpful to check the Qlik community forums or resources for specific examples or to get support from other Qlik developers. Additionally, ensure that your data model supports the relationships required for this filter to work correctly.

I hope this will help you

Best Regards,

Maxim Time Clock

 

MayilVahanan

Hi

Try like below

=Aggr(if(
len(trim(vID)) = 0,
text(Only({<[contact_now_30d.CUST_NUM] = {'$(vCUSTNO)'}>}[contact_now_30d.Program])),
text(Only({<[contact_now_30d.custnmbr] = {'$(vID)'}>}[contact_now_30d.Program]))
), [contact_now_30d.Program])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Ashley55
Contributor
Contributor
Author

Hi @jessewallick ,

Thanks for your support, but this function actually works in "KPI" tool, however thanks for improve the function to avoid when user input blank space.

 

Hi @MayilVahanan ,

It works !! thank you so much! I trapped in this function few weeks!