Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
bramvdpoel
New Contributor II

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!

1 Solution

Accepted Solutions
bertdijks
New Contributor III

Re: If value then Load Column A else load Column B

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);

5 Replies
OmarBenSalem
Esteemed Contributor

Re: If value then Load Column A else load Column B

Exactly as u said it,

 

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

bertdijks
New Contributor III

Re: If value then Load Column A else load Column B

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
Esteemed Contributor

Re: If value then Load Column A else load Column B

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

bertdijks
New Contributor III

Re: If value then Load Column A else load Column B

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

 

bramvdpoel
New Contributor II

Re: If value then Load Column A else load Column B

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

Community Browser