Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
tracycrown
Creator III
Creator III

Memory Variable Script

Dear all

Kindly advise how to write a simple script to store the record numbers (Period) and values (Sales) of first & last records as memory variables for Period (P1=1 & P2=16) and Sales (T1=4.8 & T2=8.4).

Thank you

Tracy

2 Solutions

Accepted Solutions
rubenmarin

Hi Tracy, if you add a condition to retrieve only files with sales:

Where Len(Trim(Sales))>0;

 

The variables can be created like:

LET P1 = Peek('t',0,'Sales');
LET T1 = Peek('Sales',0,'Sales');
LET P2 = Peek('t',NoOfRows('Sales')-1,'Sales');
LET T2 = Peek('Sales',NoOfRows('Sales')-1,'Sales');

View solution in original post

tracycrown
Creator III
Creator III
Author

Dear Rubenmarin
Thank you so much for your help, you are very helpful.
Wishing you and your family a Happy, Healthy and Prosperous New Year 2019.
Tracy

View solution in original post

2 Replies
rubenmarin

Hi Tracy, if you add a condition to retrieve only files with sales:

Where Len(Trim(Sales))>0;

 

The variables can be created like:

LET P1 = Peek('t',0,'Sales');
LET T1 = Peek('Sales',0,'Sales');
LET P2 = Peek('t',NoOfRows('Sales')-1,'Sales');
LET T2 = Peek('Sales',NoOfRows('Sales')-1,'Sales');

tracycrown
Creator III
Creator III
Author

Dear Rubenmarin
Thank you so much for your help, you are very helpful.
Wishing you and your family a Happy, Healthy and Prosperous New Year 2019.
Tracy