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

List of id:s from a list of total id:s

Hi,

I need help in the script getting out a list of id:s of merchants from the merchant table to identify if that id should be in a special group.

id;merchant_name

1;m1

2;m2

3;m3

4;m4

5;m5

6;m6

7;m7

8;m8

9;m9

10;m10

the id 1,5,10 companion Group_1

the id 2,3,9 companion Group_2

and all other id:s companion Other

Should I do that as a if statement or is there a more better way to do this in the script?

Thanks ahead!

1 Solution

Accepted Solutions
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

I would always use an if-statement, something like:

Load ...

If(Match(ID,1,5,10),'Group_1',If(Match,ID,2,3,9),'Group_2','Other')) As Groups,

...

From ...;

View solution in original post

2 Replies
Not applicable
Author

You can do this with apply map. Your code should be as follows.

Test:

Mapping Load * inline [

ID,Group

1, companion Group_1

5, companion Group_1

10, companion Group_1

2, companion Group_2

3, companion Group_2

9, companion Group_2

];

Load *,ApplyMap('Test',id,'Others') as Group;

Load * inline [

id,merchant_name

1,m1

2,m2

3,m3

4,m4

5,m5

6,m6

7,m7

8,m8

9,m9

10,m10

];

Find the working example with this post.

- Sridhar

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

I would always use an if-statement, something like:

Load ...

If(Match(ID,1,5,10),'Group_1',If(Match,ID,2,3,9),'Group_2','Other')) As Groups,

...

From ...;