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

How to create a flag with same value in the loading script

Hi there, 

i have a problem here. i need to write this in loading script, as a flag/dimension. 

My expected result, when i add a TYPE dimension, it will help me to differentiate which ID number is 'positive with same ID' and 'Not the same'.

jim_chan_0-1608633771027.png

This is the ID number Group data which indicate which ID number is in the same ID group.

jim_chan_1-1608633949093.png

 

I have attached a sample qvw file, please help me out!

 

Rgds

 

Jim

 

 

1 Solution

Accepted Solutions
MayilVahanan

Hi @jim_chan 

Try like below

Temp:
LOAD * INLINE [
ID_GROUP, ID_NUMBER
10001, 12345
99999, 678910
10001, 135789
];

Join
LOAD * INLINE [
ID_NUMBER,COUNTRY,COLOR
12345, US,BLUE
678910, JAPAN,RED
135789, ITALY,ORANGE
];

Join
Load *, if(Count = 1, 'Not Same', 'positive with same ID') as TYPE;
Load ID_GROUP, Concat(ID_NUMBER, ',') as Group, Count(Distinct ID_NUMBER) as Count Resident Temp
group by ID_GROUP;

MayilVahanan_0-1608699728878.png

 

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

4 Replies
jim_chan
Specialist
Specialist
Author

hello anyone?

edwin
Master II
Master II

the requirement is unclear.  with these two tables, how do you identify which ones are positive line with same ID?
 what are the rules?

jim_chan
Specialist
Specialist
Author

example ID number 12345 & 135789, this 2 numbers are in the same ID_GROUP 10001. 

MayilVahanan

Hi @jim_chan 

Try like below

Temp:
LOAD * INLINE [
ID_GROUP, ID_NUMBER
10001, 12345
99999, 678910
10001, 135789
];

Join
LOAD * INLINE [
ID_NUMBER,COUNTRY,COLOR
12345, US,BLUE
678910, JAPAN,RED
135789, ITALY,ORANGE
];

Join
Load *, if(Count = 1, 'Not Same', 'positive with same ID') as TYPE;
Load ID_GROUP, Concat(ID_NUMBER, ',') as Group, Count(Distinct ID_NUMBER) as Count Resident Temp
group by ID_GROUP;

MayilVahanan_0-1608699728878.png

 

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