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

Create Flag

Hi,

i have a data-set as follow. I would like to implement in the loading script a FLAG that should be equal to Y if on the order_number is contained the item number=AAAA.

Which could be best way to do this?
THanks!

qlikviewaf_1-1620824676660.png

 

 

 

5 Replies
MayilVahanan

HI @qlikviewaf 

Try like below

Table1:
LOAD Region, OrderNumber, Item, OrderType, Amount from ursourcetable;

Join
Load OrderNumber, 'Y' as Flag Resident Table1 Where Item = 'AAAA';

Hope it helps

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

What if for the same order i got 2 item AAAA listed ? 

I guess that the join below, needs to be adjusted in order to load only first row found, avoiding duplicates then. It make sense ? how can this be done

Join
Load OrderNumber, 'Y' as Flag Resident Table1 Where Item = 'AAAA';

 

Thanks!

mato32188
Specialist
Specialist

Hi @qlikviewaf ,

I would choose ApplyMap approach, iow fast lookup. In script editor do the following:

MAP: //select order numbers where item = AAAA

mapping load distinct

OrderNumber,

'Y'

from XXX

where Item = 'AAAA';

final table:

Load *,

ApplyMap('MAP',OrderNumber,'N') as Flag

From XXX;

BR

m

ECG line chart is the most important visualization in your life.
MayilVahanan

HI @qlikviewaf 

You can use distinct load 

Join
Load distinct OrderNumber, 'Y' as Flag Resident Table1 Where Item = 'AAAA';

Or

you can use Applymap as suggested by @mato32188 

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