Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
adnan_rafiq
Partner - Creator II
Partner - Creator II

Creating Rows problem

Hi Gurus,

Just some scripting wisdom is in need, if I have a record as follows.

OrdernoStartDateDuration
12345611/11/20165

If I want to repeat this record depending on the Duration number i.e 5  how would I do that.

So my resulting data set should be

OrdernoDate
12345611/11/2016
12345612/11/2016
12345613/11/2016
12345614/11/2016
12345615/11/2016
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

LOAD

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

       Orderno

FROM

[https://community.qlik.com/thread/240200](html, codepage is 1252, embedded labels, table is @1)

while IterNo() <= Duration;


Capture.PNG

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Something like this:

LOAD

  OrderNo,

  Date(StartDate + IterNo()) - 1 as Date

FROM

WhereWhile IterNo() < Duration;

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
tresesco
MVP
MVP

Try like:

LOAD

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

       Orderno

FROM

[https://community.qlik.com/thread/240200](html, codepage is 1252, embedded labels, table is @1)

while IterNo() <= Duration;


Capture.PNG

adnan_rafiq
Partner - Creator II
Partner - Creator II
Author

Thanks for the prompt response,

But the "From" part does not seem clear enough, Is it supposed to be autogenerate or the same table . If it is the same table as

OrdernoStartDateDuration
12345611/11/20165

Then this will be producing only 1 row. How will it create 5 rows.

adnan_rafiq
Partner - Creator II
Partner - Creator II
Author

Yes the While clause does the trick.

Thanks a million