Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am new to QlikView and am stuck with an issue in the script side.
I need to create a variable and store a value, only to be used by the next LOAD statement.
Here is how it goes.
FACT:
LOAD fields from FACT.qvd;
SET CYEAR=FACT.FISCAL_YEAR;
DIM:
IF($(CYEAR)-DIM.FISCAL_YEAR=0,DIM.FISCAL_WEEK,0)
FROM DIM.qvd;
The issue is that the $(CYEAR) is replaced by FACT.FISCAL_YEAR when the application is refreshed. And it pops up an error message that the field is not found.
Thanks for your help..
Hi,
For load value from any table use Peek() and for storing use LET rather than SET
FACT:
LOAD fields from FACT.qvd;
LET CYEAR = Peek('FACT.FISCAL_YEAR',-1,'FACT');
DIM:
IF($(CYEAR)-DIM.FISCAL_YEAR=0,DIM.FISCAL_WEEK,0)
FROM DIM.qvd;
Note:- And what value you need in the variable CYEAR i suppose max year if the order of table is ascending then you get max year value, otherwise provide sample file.
Regards
Anand
Try LET instead of SET ...
let me know
Hi,
For load value from any table use Peek() and for storing use LET rather than SET
FACT:
LOAD fields from FACT.qvd;
LET CYEAR = Peek('FACT.FISCAL_YEAR',-1,'FACT');
DIM:
IF($(CYEAR)-DIM.FISCAL_YEAR=0,DIM.FISCAL_WEEK,0)
FROM DIM.qvd;
Note:- And what value you need in the variable CYEAR i suppose max year if the order of table is ascending then you get max year value, otherwise provide sample file.
Regards
Anand
LET worked in loading the application with no errors but the data was not as expected.
PEEK worked perfectly.Thanks for your help.
Thanks Anand.
Worked like a charm..