Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to Convert Excel code into Qliksense and i'm trying to do the following within a preceding load statement:
Load*,
if Len(Var1>0) then
Var1 as Col1
elseif Len(Var2>0) then
if IsNum(Var2) Then
if Var2 > 0 Then
Var2 as Col2;
Var3 as Col3;
end if
end if
end if
end if
;
Load ...
FROM source;
I also know you cant do if...THEN within a load statement. So, my question is, is there another way to achieve similar result in Qliksense? Your help would be greatly appreciated!
Thank you
May be this way?
if Len(Var1>0) then
Load Var1 as Col1 Autogenerate ($(Var1));
elseif Len(Var2>0) then
if IsNum(Var2) Then
if Var2 > 0 Then
Load Var2 as Col2 Autogenerate ($(Var2));;
Load Var3 as Col3 Autogenerate ($(Var2));;
end if
end if
end if
end if
Hey Anil,
Thank you for your reply. Im sorry i dont understand why you are using AutoGenerate($(Var)). Could you please explain?
Following is my code from my script:
if Len(ApplyMap('L2NPoRMap',CompoundKey_2)) > 0 then
Load *,
$(cOnRequestPrice) as FL2NP
Resident Material_Master_Table;
elseif (Len(ApplyMap('StandardPriceNPMap',CompoundKey_2))> 0 ) then
Load *,
ApplyMap('StandardPriceNPMap',CompoundKey_2) as FL2NP,
ApplyMap('StandardPriceNPMap',CompoundKey_2) as FL2NPOverRide
Resident Material_Master_Table;
elseif Len(FL1NPoR) > 0 Then // FL1NPoR is a field inside Material_Master_Table
Load *,
$(cOnRequestPrice) as FL2NP
Resident Material_Master_Table;
elseif(Len(FL1NP) > 0 AND IsNum(FL1NP) AND FL1NP > 0) then // FL1NP is a field inside Material_Master_Table
Load *,
FL1NP * ApplyMap('FacMap',CompoundKey_2) as FL2NP
Resident Material_Master_Table;
end if
I'm new to Qlik so im not sure how qlik handles the iterations. So, my questions are as follows if someone is kind enough to answer:
1: Will the 2nd elseif go through my entire table or just the first row?
2: CompoundKey_2 is a field inside Material_Master_Table, am i allowed to use that field outside of the load statement?
3: The first elseif should return the length as 1 because my data has a value of '0' in it which is lenght 1. However, it doesnt return anything, just NULL. why might that be the case?
Thank you
Sorry idk why my reply was removed from this post.
my script so far in Qlik:
if Len(ApplyMap('L2NPoRMap',CompoundKey_2)) > 0 then
Load *,
$(cOnRequestPrice) as FL2NP
Resident Material_Master_Table;
elseif (Len(ApplyMap('StandardPriceNPMap',CompoundKey_2))> 0 ) then
Load *,
ApplyMap('StandardPriceNPMap',CompoundKey_2) as FL2NP,
ApplyMap('StandardPriceNPMap',CompoundKey_2) as FL2NPOverRide
Resident Material_Master_Table;
elseif Len(FL1NPoR) > 0 Then // FL1NPoR is a field inside Material_Master_Table
Load *,
$(cOnRequestPrice) as FL2NP
Resident Material_Master_Table;
elseif(Len(FL1NP) > 0 AND IsNum(FL1NP) AND FL1NP > 0) then // FL1NP is a field inside Material_Master_Table
Load *,
$(cOnRequestPrice) as FL2NP
Resident Material_Master_Table;
end if
My Questions:
1: Will the second Elseif iterate through my entire table or just the first row?
2: CompoundKey_2 is a field in Materail_Master_Table, am i using it right?
3: My first elseif should return the lenght of 1 because my data hold a value of 0. However, it is returning NULL. Any idea why that might be the case?
Please and thank you for helping.