Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Gump123
Contributor
Contributor

Flag on field

HI i have data set , which has Fee collumn flag with value 1 and 0 only .   now i want to conver 1= Yes and 0 = no on script.

 

 

 

 

Labels (1)
2 Replies
ggijben
Partner - Creator II
Partner - Creator II

Hi @Gump123 , 

Can you try:

IF( [Fee collumn flag] = 1, 'Yes',

      IF( [Fee collumn flag] = 0, 'No')) AS New_Flag
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Slightly more compact:

If([Fee column flag], 'Yes', 'No') as New_Flag

Another technique I like, especially when I have multiple flag fields to map, is to use a mapping table.

YNMap:
Mapping
LOAD num, Dual(str, num)
Inline [
num, str
0, No
1, Yes
];

Map [Fee Flag] using YNMap;
Map [Shipped Flag] using YNMap;

Data:
LOAD * Inline [
OrderId, Fee Flag, Shipped Flag
11, 1, 1
12, 0, 1
13, 0, 0
];

rwunderlich_0-1657583373347.png

 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com