Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
sridhar423
Contributor III
Contributor III

How to assign variables to for loop,in which values are pulled from Field

Hi All,

I'm unable to assign max and min values to the variables.I'm getting error ,here is my code is there any fault,can any one help me out from this.

Sheet1:

LOAD

BusinessDate,

Year(BusinessDate) as Year,

     BusinessID,

     CustomerName,

     Location,

     ShipperID

    

FROM

(biff, embedded labels, table is Sheet1$);

Let vMin=Min(Year);

Let vMax=Max(Year);

For i=$(vMin) to $(vMax);

NoConcatenate

T:

LOAD *

Resident Sheet1

Where Year=$(i);

STORE T into $(i).qvd;

Drop Table T;

NEXT i;

2 Replies
vikasmahajan

Brefore loading excel sheet create another load

MinMax:

Load  min(year) as MinYr,

             Max(year) as Maxyr

FROM

(biff, embedded labels, table is Sheet1$);

store this into varibles

then use in script

HTH

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
marcus_sommer

You could use peek() or fieldvalue() to grab the values from a table how suggested from Vikas Mahajan - see here for examples: http://community.qlik.com/blogs/qlikviewdesignblog/2013/04/08/peek-vs-previous-when-to-use-each.

But there is a better way especially by large fact-tables: http://qlikviewcookbook.com/2013/09/fastest-method-to-read-maxfield-from-a-qvd/

- Marcus