Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am using loop reduce by Country field .
I have 2 values in Country field US, UK so job is creating 2 QVWs from main qvw.
But in the qlikview script we have defined variable
LET LOC = if(Country='US',1,2);
but when ever i am running the job , it is creating two Qvws but LOC is always assigning 2.
Please let me know how to Pass the Country Field value into script from reduction field.
HI,
Not sure how you an do this in script.
Can you not just add the expression to a variable in the front end?
Mark
as i have one qvw and i am reducing it on the basis of Country field.
I can not do any thing in new qvws .
but i need to assign value to variable on the basis of country.
LET LOC = if(Country='US',1,2);
But it is always assigning LOC=2 as Country = US is not executing as value of Country is passing by job
Please let me know how to pass the reduction field value to variable in to script.
Hi,
What is happening here is you can not use the If statement like this.
Try below Script.
MaxString:
Load Maxstring(Country) as MaxCountry
From XYZ;
Let vMax = Peek('MaxCountry',0,'MaxString');
Let LOC = if($(vMax) = 'US',1,2);
Regards,
Kaushik Solanki
Reduction is done after script is run. Or to say it another way, script is run before reduction. So you will always have the full set of data -- both countries -- when the script runs.
-Rob