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

If and match with multiple repeated values in Qliksense script

Hello All,

I have a small issue with if and match in script with multiple similar values.

I am trying to create a flag with below conditions. I have a feild called Division. If this division value is from 0 to 8 then it is Complete and if it is from 4 to 8 then it is Fulfilled. I tried below.

A:

Load * inline[

Division,

0,

1,

2,

3,

4,

5,

6,

7,

8];

B:

Load *, 

If(match(division,0,'1','2','3','4'),'fulfilled',

If(match(division,0,'1','2','3','4','5','6','7','8'),'complete')) as flag resident A;

Now here since division values are repeating for complete flag in front end it only shows values from 5 to 8 where as it should show from 0 to 8. For fulfilled the values are shown correctly.

Please help.

  • Thanks in advance.

 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

You cant assign two values to the same row. You need to duplicate your A rows for 0 to 4 or add an dimension table that associates two values for the Division 0-4 and one value for 5 - 8.

You could try this script. (Use the join if you want to duplicate Division entries rather than a link table.

A:
Load * inline[
Division,
0,
1,
2,
3,
4,
5,
6,
7,
8];

B:
//LEFT JOIN (A)
LOAD DivMin - 1 +IterNo() as Division, Flag
inline [
     DivMin,  DivMax, Flag
     0,       4,      Fullfilled
     0,       8,      Complete]
while DivMin - 1 +IterNo() <= DivMax;

 

View solution in original post

3 Replies
sunainapawar
Creator
Creator
Author

Hello,

Anyone any update on the above scenario.

Vegar
MVP
MVP

You cant assign two values to the same row. You need to duplicate your A rows for 0 to 4 or add an dimension table that associates two values for the Division 0-4 and one value for 5 - 8.

You could try this script. (Use the join if you want to duplicate Division entries rather than a link table.

A:
Load * inline[
Division,
0,
1,
2,
3,
4,
5,
6,
7,
8];

B:
//LEFT JOIN (A)
LOAD DivMin - 1 +IterNo() as Division, Flag
inline [
     DivMin,  DivMax, Flag
     0,       4,      Fullfilled
     0,       8,      Complete]
while DivMin - 1 +IterNo() <= DivMax;

 

sunainapawar
Creator
Creator
Author

Hello Vegar,

Thank you so much for your help.

Above solution is working.