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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
bramvdpoel
Contributor III
Contributor III

If value then Load Column A else load Column B

Hello,

I'm pretty new to qlik and trying some things but can't seem to fix the following problem:

I want to load a new column [Prijs] to the table.

If the value in  column [Prijsind] = 'AAB' then it should load [Brutoprijs] Else it should load [Dubbel].

'MP':
Directory;
LOAD
[@2:4] as Voorloper,
text([@5:26]) as Artikelcode,
[@30:52] as TecDoc,
[@58:81] as EAN,
[@91:125] as Omschrijving,
[@237:248] as Bruto1,
[@249:250] as Bruto2,
[@251:253] as Prijsind,
[@257:259] as ExtArtID,
[@260:270] as [min aantal],
[@274:280] as [aantal verpakking],
[@317:320] as btw,
[@321:334] as verwijderings,
[@2:4] & [@257:259] as Match,
[@237:250] as Brutoprijs,
[@237:250]*2 as Dubbel

FROM
[G:\Temp\mp_all_rai_NL.txt]
(fix, codepage is 1252, no labels);

 

Can anyone help me?

Thanks in advance!

Labels (1)
1 Solution

Accepted Solutions
bertdijks
Partner - Contributor III
Partner - Contributor III

You can add this by a load on load:

 

'MP':
Directory;

Load

*,
if([Prijsind] = 'AAB', [Brutoprijs] , [Dubbel]) as YourColumn

;
LOAD
[@2:4] as Voorloper,
text([@5:26]) as Artikelcode,
[@30:52] as TecDoc,
[@58:81] as EAN,
[@91:125] as Omschrijving,
[@237:248] as Bruto1,
[@249:250] as Bruto2,
[@251:253] as Prijsind,
[@257:259] as ExtArtID,
[@260:270] as [min aantal],
[@274:280] as [aantal verpakking],
[@317:320] as btw,
[@321:334] as verwijderings,
[@2:4] & [@257:259] as Match,
[@237:250] as Brutoprijs,
[@237:250]*2 as Dubbel

FROM
[G:\Temp\mp_all_rai_NL.txt]
(fix, codepage is 1252, no labels);

View solution in original post

5 Replies
OmarBenSalem
Partner - Champion II
Partner - Champion II

Exactly as u said it,

 

if([Prijsind] = 'AAB',  [Brutoprijs] , [Dubbel]) as YourColumn

bertdijks
Partner - Contributor III
Partner - Contributor III

You can add this by a load on load:

 

'MP':
Directory;

Load

*,
if([Prijsind] = 'AAB', [Brutoprijs] , [Dubbel]) as YourColumn

;
LOAD
[@2:4] as Voorloper,
text([@5:26]) as Artikelcode,
[@30:52] as TecDoc,
[@58:81] as EAN,
[@91:125] as Omschrijving,
[@237:248] as Bruto1,
[@249:250] as Bruto2,
[@251:253] as Prijsind,
[@257:259] as ExtArtID,
[@260:270] as [min aantal],
[@274:280] as [aantal verpakking],
[@317:320] as btw,
[@321:334] as verwijderings,
[@2:4] & [@257:259] as Match,
[@237:250] as Brutoprijs,
[@237:250]*2 as Dubbel

FROM
[G:\Temp\mp_all_rai_NL.txt]
(fix, codepage is 1252, no labels);

OmarBenSalem
Partner - Champion II
Partner - Champion II

Isn't this the same response I gave? I'll assume u havn't seen mine 🙂 

bertdijks
Partner - Contributor III
Partner - Contributor III

Your right (your formula) ; but for somebody new to Qlik it may be unclear how to add it in the script.

 

bramvdpoel
Contributor III
Contributor III
Author

Great! Thanks a lot for the whole script, otherwise i didn't know where to put it!