Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
]
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' );
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';
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
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
]
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
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) ;
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);