Qlik Community

QlikView Documents

Documents for QlikView related information.

Iterno() working with while

Iterno() working with while

Hello Friends,

I publish here a simple examples how Iterno( ) function works with the While function to make dates between two ranges with using differently. Iterno( ) function returns integer 1 and it is work with while function until the condition is not satisfy and normally this function used in the master calendar for date creation. Where we want to create a date between any range like we say from any date to any end date. Here i explain i have two dates FromDate and Todate and this dates are used as Num dates because Iterno( ) works on the num dates.This is very basic example with explanation of the Iterno( )

Suppose the dates

FromDate = 01/04/2014

ToDate = 10/04/2014

1. While IterNo( ) <= ToDate - FromDate +1

and we convert this dates FromDate  and ToDate into number by Num function

Num(FromDate) = 41730

Num(ToDate) = 41739

so if we see While statement and put values and at initial iterno( ) start from 1

While IterNo( ) <= ToDate - FromDate +1

While IterNo( ) <= 41739 - 41730 +1

then equation will be

While IterNo( ) <= 10

Means while loop runs 10 times until IterNo( ) <= 10 while this loop runs our dates are created by adding 1 to value 41730 like 41731,41732......41740 and this are in num then we convert this dates into date by Date(Num(FromDate)).

Here we get date from 01/04/2014 to 10/04/2014

2.While IterNo( ) <= ToDate - FromDate -1

if we see equation here for while condition with the dates

Num(FromDate) = 41730

Num(ToDate) = 41739


While IterNo( ) <= ToDate - FromDate -1

While IterNo( ) <= 41739 - 41730 - 1

then equation is

While IterNo( ) <= 8

Means in this while condition loop runs 8 times and we are get 8 date values only

Here we get dates from 01/04/2014 to 08/04/2014

3.Date($(vDateMin) + RowNo( ) -1) AS TempDate

for this dates suppose Date($(vDateMin) is 01/04/2014

then we get the values for equation like

Date($(vDateMin) + RowNo() -1)

For first record

vDateMin + 1 - 1  = 41731

For Second record

vDateMin + 2 -1 = 41732

and so on until loop satisfy the condition then it will stop and a field is obtain named TempDate which contain date format and date from 01/04/2014 to 08/04/2014.



Any suggestion friends this is small piece of work.

Not applicable

Well explained. I was under little confusion regarding the concept u explained above. Really it is very helpful.

Thank u.

Thanks try to implement this in any practical application then you clear it.

Honored Contributor

Thanks Anand,its very helpful post.

please can you give an example other than dates,where IterNo( ) is used.



Valued Contributor II

Good doc.

Version history
Revision #:
1 of 1
Last update:
‎04-15-2014 01:37 AM
Updated by: