Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
YoussefBelloum
Champion
Champion

Nested if don't work

Hi Community,

I have a problem on this: (listbox)

=if(v_DIVISION='VSDACHBENSCAN' and wildmatch(concat([Company code],','),'*NL*'),

if(match(Division_customer,'D09'),CustomersC))


as you can see, nested if, but resulting to nothing..


the problem is that when I use these 3 conditions separetely, they works as expected:


  • v_DIVISION is declared on the script and the output is : VSDACHBENSCAN

          when I put the variable v_DIVISION in a text object I have this: VSDACHBENSCAN


  • [Company code] give 'NL10' and 'NL11', that's why I used wildmatch(concat([Company code],','),'*NL*')

          when is use this on a textbox: if(wildmatch(concat([Company code],','),'*NL*'),'NL','NOT NL')  I have NL on my textbox


  • For Division_customer, I have a list of Customers = D09 and a list = D07

          when I use this on a listbox, if(match(Division_customer,'D09'),CustomersC) I have the right list of D09 customers.

Why combined together, these conditions don't work ?





1 Solution

Accepted Solutions
sunny_talwar

Try this

=Aggr(If(v_DIVISION = 'VSDACHBENSCAN' and WildMatch(Concat([Company code], ','), '*NL*') and Match(Division_customer, 'D09'), CustomersC), CustomersC)

View solution in original post

13 Replies
sunny_talwar

May be try this

=If($(v_DIVISION) = 'VSDACHBENSCAN' and WildMatch(Concat([Company code], ','), '*NL*') and Match(Division_customer, 'D09'), CustomersC)

YoussefBelloum
Champion
Champion
Author

My variable is declared like this:

LET v_DIVISION=replace(mid(DocumentName(),index(DocumentName(),'-')+2),'.qvw','');


so I call it without $ to have my result.

and I already tried to use AND instead of the second IF.. it is the same.. it shows nothing



sunny_talwar

Try this

=Aggr(If(v_DIVISION = 'VSDACHBENSCAN' and WildMatch(Concat([Company code], ','), '*NL*') and Match(Division_customer, 'D09'), CustomersC), CustomersC)

YoussefBelloum
Champion
Champion
Author

It is working..

can you explain this ?

sunny_talwar

Since you had Concat() in your expression, this was probably error-ing out... Either you need to have TOTAL qualifier (which to me did not make sense), you needed to add a dimension

YoussefBelloum
Champion
Champion
Author

PAY HIM ! PAY HIIM !!

no points for today

YoussefBelloum
Champion
Champion
Author

Thank you for this.

Since Company code is related to section access and users don't need to use it because data is already reduced to it and since I need to make a test on NL value without having my field selected..

do you have an alternative to this:

WildMatch(Concat([Company code], ','), '*NL*')


to detect if I have NL values on that field without using concat and avoid Aggr().... ??


sunny_talwar

So, you don't want to show selection in Company code, right? May be try this....

=Aggr(Only({<CustomersC = {"=v_DIVISION = 'VSDACHBENSCAN' and WildMatch(Concat([Company code], ','), '*NL*') and Match(Division_customer, 'D09')"}>} CustomersC), CustomersC)

YoussefBelloum
Champion
Champion
Author

No, sorry,

I mean that I want to detect if on the field "Company code", I have "NL" values, without doing selections on NL (on that field) and without using wildmatch concat.. I want to know if there is an alternative to Wildmatch concat