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

ApplyMap

I have the below script and would like to output  where vatcode is S, I need to output standard; vatcode Z I need to output zero, below is my current load script

Products:

Load [product]

FROM

\\appserver1\Qlikview\qlikviewdatafiles\qvds\Products.qvd

(qvd);

the current output is either S or Z

1 Solution

Accepted Solutions
trdandamudi
Master II
Master II

You can try as below:

Products:

Load [product],

If(Vat='S','Standard',
If(Vat='Z','Zero')) as Vat

FROM

\\appserver1\Qlikview\qlikviewdatafiles\qvds\Products.qvd (qvd) ;

Below is a sample code and output I tried:

Data:
Load
ID,
Type,
Vat as Old_Vat,
If(Vat='S','Standard',
If(Vat='Z','Zero')) as Vat;
Load * Inline [
ID,Type,Vat
10,A,S
20,B,Z
30,C,S
]

View solution in original post

7 Replies
its_anandrjs

In Product field what are data items will is S and Z or you want to load only S and what do you mean by vatcode

Ex:-

Do this if i am understand

Products:

Load [product]

FROM

\\appserver1\Qlikview\qlikviewdatafiles\qvds\Products.qvd

(qvd) Where [product] = 'S';


Or

Products:

Load [product]

FROM

\\appserver1\Qlikview\qlikviewdatafiles\qvds\Products.qvd

(qvd) Where Match( [product], 'S' );


trdandamudi
Master II
Master II

Not very clear what you need, May be you can try as below.... If this is not correct, can you please share a sample.

Products:

Load [product]

FROM

\\appserver1\Qlikview\qlikviewdatafiles\qvds\Products.qvd (qvd)

Where

vatcode='S';

dmxmikey
Creator
Creator
Author

I need to output where vat is S I require word standard and where vat is Z I need word zero

Sent from my iPhone

trdandamudi
Master II
Master II

You can try as below:

Products:

Load [product],

If(Vat='S','Standard',
If(Vat='Z','Zero')) as Vat

FROM

\\appserver1\Qlikview\qlikviewdatafiles\qvds\Products.qvd (qvd) ;

Below is a sample code and output I tried:

Data:
Load
ID,
Type,
Vat as Old_Vat,
If(Vat='S','Standard',
If(Vat='Z','Zero')) as Vat;
Load * Inline [
ID,Type,Vat
10,A,S
20,B,Z
30,C,S
]

dmxmikey
Creator
Creator
Author

have used below and it works but was wondering how to add a third condition eg if Vat='H','Reduced?

                       

Products:

Load [product],

If(Vat='S','Standard',
If(Vat='Z','Zero')) as Vat

micheledenardi
Specialist II
Specialist II

Products:

Load [product],

If(Vat='S','Standard',
If(Vat='Z','Zero',

if(Vat='H','Reduced'))) as Vat

FROM

\\appserver1\Qlikview\qlikviewdatafiles\qvds\Products.qvd (qvd) ;

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Miguel_Angel_Baeyens

It seems that using a mapping load is indeed the right use for what you are looking for.

First you need to define the original and descriptive values, using any form of LOAD, I'm using INLINE for the sake of the example, but it could be from another table, SQL or file:

VatcodeMap:

MAPPING LOAD

  *

INLINE [

Original, Extended

Z, Zero

V, Variable

S, Standard

H, Reduced

];

Then use the ApplyMap() function in the Product table:

Products:

LOAD

  *,

  ApplyMap('VatcodeMap', Vatcode) AS Vatcode_Descriptive

FROM Products.qvd (qvd);