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

If- then formule

Hello

Often i use this kind of formula: if (CategoryID= 5 or CategoryID=6,'Footwear','Clothing') as CategoryType

Now i have a problem with a field: status In this field i can have 3 values

O , M or F ; this values i wanna translate to

O=Off M=Mag and F=Fac and the field must have the name Status

if (Status=O, .................................. ?

Who can help



1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello Francis,

You may use something like (untested)

If(Pick(Match(Status, 'O', 'M', 'F'), 'Off', 'Mag', 'Fac'))


But I'd strongly recommend you to use a mapping table:

StatusMap:MAPPING LOAD * INLINE [Input, OutputO, OffM, MagF, Fac]; LOAD *, ApplyMap('StatusMap', Status) AS StatusFROM file.qvd (qvd);


Hope that helps

View solution in original post

3 Replies
Miguel_Angel_Baeyens

Hello Francis,

You may use something like (untested)

If(Pick(Match(Status, 'O', 'M', 'F'), 'Off', 'Mag', 'Fac'))


But I'd strongly recommend you to use a mapping table:

StatusMap:MAPPING LOAD * INLINE [Input, OutputO, OffM, MagF, Fac]; LOAD *, ApplyMap('StatusMap', Status) AS StatusFROM file.qvd (qvd);


Hope that helps

Not applicable

You can use something more simple.....

IF(Status='0','Off',IF(Status='M','Mag','FAC'))

francisvandergr
Partner - Creator II
Partner - Creator II
Author

thank you. I have made a mapping table. I can use this often in future!