Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

Not applicable

Store a field into a variable

Hi everyone,

I'm trying to create a table with some years starting from a label field.

I have the label PRICE_2013 and with the instruction:

Right (@37,4) as starting_Year

I can get 2013 tha is the starting year of my study. Now I'd like to put this starting_Year into a variable  ($vyear) in order to make a loop and icrease automatically the value of the year like this:

//first year

LOAD

$(vyear) as Year,

...

////Second year

//LOAD

//($(vyear)+'1') as Year,

.....

....

I tried to set as variable with GetFieldSelections() but It doesn't work because It doesn't recognize the filed starting_Year, maybe because It don't see 2013 as an integer but as a string i don't know!

Maybe somebody can help!

2 Replies
Not applicable

Re: Store a field into a variable

Hi Ylenia,

maybe this helps you to answer your question:

// preparing raw input data:

InitData:

LOAD

    Right ('PRICE_2013',4) AS StartYear

AutoGenerate 1;

// fill Variable

LET vStartYear = Peek('StartYear');

//exampl for next 3 years:

LOAD

    $(vStartYear) + RecNo() AS MyYear

AutoGenerate 3;

Roland

Employee
Employee

Re: Store a field into a variable

Hi Ylenia,

Thank you for your interest in QlikView and thank you for participating in the Education Services Forum.  For the future, please only use the category "QlikView" questions when asking specific QlikView questions.  The Tips and Trips and announcements are meant to share important information, not to store questions.

Many thanks,

Sarah Miller

Community Browser