Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am currently doing the following as a Dimension in a chart, how Do I get this into a script?
Transactions is one table, ABICode is another table
=if(Transactions.ProductID = '33', Num(ABICode.ABIVixaInsuranceGroup),
if(Transactions.ProductID = '31', Num(ABICode.ABIBikeInsuranceGroup),Num(ABICode.ABIAxaInsuranceGroup)))
So in the script I would want to say something like - but i'm not sure where to put into the script.
if(Transactions.ProductID = '33', Num(ABICode.ABIVixaInsuranceGroup),
if(Transactions.ProductID = '31', Num(ABICode.ABIBikeInsuranceGroup),Num(ABICode.ABIAxaInsuranceGroup))) AS NewAbiInsurance Group
Try something like this:
Data:
Load *,
if(ProductID = '33', ABIVixaInsuranceGroup,
if(ProductID = '31', ABIBikeInsuranceGroup,
ABIAxaInsuranceGroup
)) as NewAbiInsuranceGroup;
Load ProductID,
Num(ABIVixaInsuranceGroup) as ABIVixaInsuranceGroup,
Num(ABIBikeInsuranceGroup) as ABIBikeInsuranceGroup,
Num(ABIAxaInsuranceGroup) as ABIAxaInsuranceGroup,
Field2,
Field3;
SQL Select ProductID,
ABIVixaInsuranceGroup,
ABIBikeInsuranceGroup,
ABIAxaInsuranceGroup,
Field2,
Field3
From Table1;
Am I suppossed to change the name Table1? as this produces an error when I add to script.
Kev.
Yes, you must use the correct SQL sentence, i.e., field names, table names, etc.
These are tables created in Qlikview not SQL.
In this case:
Data:
Load *,
if(ProductID = '33', ABIVixaInsuranceGroup,
if(ProductID = '31', ABIBikeInsuranceGroup,
ABIAxaInsuranceGroup
)) as NewAbiInsuranceGroup;
Load ProductID,
Num(ABIVixaInsuranceGroup) as ABIVixaInsuranceGroup,
Num(ABIBikeInsuranceGroup) as ABIBikeInsuranceGroup,
Num(ABIAxaInsuranceGroup) as ABIAxaInsuranceGroup,
Field2,
Field3
Resident QVTable1;
Thanks for your help Enrique, I now get the message -
Field not found - <ProductID>
Load ProductID,
Num(ABIVixaInsuranceGroup) as ABIVixaInsuranceGroup,
Num(ABIBikeInsuranceGroup) as ABIBikeInsuranceGroup,
Num(ABIAxaInsuranceGroup) as ABIAxaInsuranceGroup
Try:
Data:
Load *,
if(Transactions.ProductID = '33', ABIVixaInsuranceGroup,
if(Transactions.ProductID = '31', ABIBikeInsuranceGroup,
ABIAxaInsuranceGroup
)) as NewAbiInsuranceGroup;
Load Transactions.ProductID,
Num(ABIVixaInsuranceGroup) as ABIVixaInsuranceGroup,
Num(ABIBikeInsuranceGroup) as ABIBikeInsuranceGroup,
Num(ABIAxaInsuranceGroup) as ABIAxaInsuranceGroup,
Field2,
Field3
Resident QVTable1;
I am obviously not doing something right,
If I use Resident Transactions;
It finds Transactions.ProductID as this exists in Transactions Table but then fails on ABIVixaInsuranceGroup
If I use Resident ABICode I get this -
Field not found - <Transactions.ProductID>
Load Transactions.ProductID,
Num(ABIVixaInsuranceGroup) as ABIVixaInsuranceGroup,
Num(ABIBikeInsuranceGroup) as ABIBikeInsuranceGroup,
Num(ABIAxaInsuranceGroup) as ABIAxaInsuranceGroup,
Field2,
Field3
Resident ABICode
¿The primary key of ABICode table is ProductID?