Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikview979
Specialist
Specialist

Iterno()

Hi Experts,

What is Iterno()? how it will work please with examples ?

Regards,

Mahesh.

1 Solution

Accepted Solutions
Kushal_Chawda

Iterno() is nothing but the number of iteration you want to perform to calculate some values. iterno() always work with while statement.

for eg

ID StartDate EndDate

1   1/1/2015    2/4/2015

2   2/3/2013    10/5/2015

Now for above data if you wan to fill out the all Dates between StartDate and EndDate to get the Single Date field you can use iterno() like below

Data:

LOAD ID,

         (StartDate +iterno()-1) as Date,

FROM Table

While StartDate +iterno()-1 <= EndDate;

So for Each ID , (EndDate- StartDate) iteration will be performed to get the Date

View solution in original post

6 Replies
settu_periasamy
Master III
Master III

Have a look here with example

IterNo ‒ QlikView

Iterno() working with while

Kushal_Chawda

Iterno() is nothing but the number of iteration you want to perform to calculate some values. iterno() always work with while statement.

for eg

ID StartDate EndDate

1   1/1/2015    2/4/2015

2   2/3/2013    10/5/2015

Now for above data if you wan to fill out the all Dates between StartDate and EndDate to get the Single Date field you can use iterno() like below

Data:

LOAD ID,

         (StartDate +iterno()-1) as Date,

FROM Table

While StartDate +iterno()-1 <= EndDate;

So for Each ID , (EndDate- StartDate) iteration will be performed to get the Date

kkkumar82
Specialist III
Specialist III

Just to be different

For(i=1;i<=10 ;i++)

{

  Some code;

}

Here i is the incremental counter,

thats how Iterno() also works in a loop like while or for in Qlikview, it will give the current iteration number

Not applicable

Data:

LOAD ID,

         (StartDate +iterno()-1) as Date,

FROM Table

While StartDate +iterno()-1 <= EndDate;


why we use (-1) in above statements? please explain the execution?


kkkumar82
Specialist III
Specialist III

Let us assume Start Date is 01 - Jan - 2017 End Date is 10-Jan-2016 and we want to have all the dates between

StartDate and EndDate

For first iteration if you don' use - 1

it becomes

Load ID,

         02-Jan-2017 as Date

....

While  02-Jan - 2017 <= 10-Jan-2017;

and for further iterations you will be getting the dates as

2 - Jan - 2017 Iteration 1

3 - Jan -2017  Iteration  2

..

.

.

.

.                

10 - Jan -2017 Iteration - 9

If you see we are missing 01 - Jan - 2017 Date, I think for the requirement they want 01 - Jan -2017 Date also

Hope It is clear

But don't ask a question in a corrected answer , pick the code here and point to this thread and start a new thread