Could you please give some examples on differences between IterNo() vs RowNo().
Actually i have done some testing and found one different with autogenerate you can see in sample file.
I have attached file here.
AFAIK, IterNo() function only when you use While statement. Whereas RecNo() and RowNo() works with or without While. IterNo() is similar to using a loop find it useful in creating dates between start and end date for example.
Update: Did not see your qvw, but you do have an example of start and end date in there
I think the HELP explains both functions quite well.
(and I believe you know the iterno() help page, your sample code is part of the HELP page)
If you still have problems seeing the fundamental difference, have a look at
Looking at your your script code comments, it looks like you also want to have a look at the difference between a RESIDENT and a PRECEDING LOAD:
we can use RowNo() with while like IterNo(). Both give same results, try this:
CALENDAR: //Using RowNo()
Date($(vMin)+RowNo()-1,'DD/MM/YYYY') AS Date
CALENDAR: //Using IterNo()
Date($(vMin)+IterNo()-1,'DD/MM/YYYY') AS Date
Both will give same result.
Combination of RowNo() and IterNo() also will give same result.
I think Sunny will express you their opinion. Let me say that your code snippet - a particular case of coincidence results. This is due to the equality of sequential read one record, in which the values of RowNo() and IterNo() are the same.
Try to create a table of this type from your table "CALENDAR", for example,
Each record of table "CALENDAR" should just read twice
Date as DateIterNo
While IterNo() < 3;
And here is how will look the values IterNo() and RowNo() during the loading table
Date IterNo() RowNo()
01/01/2017 1 1
01/01/2017 2 2
02/01/2017 1 3
02/01/2017 2 4
03/01/2017 1 5
03/01/2017 2 6
So your code works. But this is a particular case. The whole assignment the functions IterNo() and RowNo() different.
Hi Andrey, thanks for your explanation.
Unfortunately i could not understand much, if you do not mind can you tell direct definition to the IterNo() in easy manner please and which cases we use.
IterNo() - this is counter the number of times considered the current record in the source table at load. Each current record will be re-read from the source table until the condition WHILE.
Source table, for example
ID1, ID2, Volume
1 5 10
2 6 20
3 7 30
I want to get out of Table1 the following table
Each record must be read twice. it is easy to do with IterNo()
If(InerNo() = 1, ID1, ID2) as ID
Volume as Volume1
While IterNo() <=2;
In short like this
IMHO there is a pretty simple explanation for this that positions three related functions - RecNo(), IterNo() and RowNo() - where they belong.
Imagine an imaginary LOAD statement with a source, a target internal table, and a WHILE suffix. Like this:
This LOAD statement will execute multiple times, and as long as there are input records. When reading record N (a single row), the following happens:
Inputrow RecNo() = N -> Processed IterNo()=1...P times -> Resulting rows stored as RowNo() = X+1 ... X+P
Note that depending on your While expression, the P value can vary between 1 and an arbitrary upper limit for each input row.
[Edit] Added a picture "because they're worth a thousand words..."
Returns an integer for the number of the currently read row of the internal table. The first record is number 1.
Returns an integer for the position of the current row in the resulting QlikView internal table. In contrast to RecNo( ), which counts the records in the raw data table, the RowNo( ) function does not count records that are excluded by where clauses and is not reset when a raw data table is Concatenation to another. The first row is number 1.
Raw data tables:
Load *, RecNo( ), RowNo( ) from Tab1.csv where A<>2;
Load *, RecNo( ), RowNo( ) from Tab2.csv where A<>5;
The resulting QlikView internal table:
hope this helps