Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Iteration?

Hi,

     I have a field 'Date' and Interval which determines my Next_Check_Date,

DateInterval(days)
20/5/2014700
21/5/201430
22/5/20143

I have to apply the following logic to find out my Next_Check_Date

for(Date+Interval<today(),

(Date+ Interval) + Interval ) and so on

This should give my Next_Check_Date,

Thanks

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

You can try something like this

Load

     Date,

     Interval,

     Date + (Interval * iterNo()) AS Next_Check_Date

FROM .....

While (Date + (Interval * iterNo())) < Today();

View solution in original post

13 Replies
sushil353
Master II
Master II

Hi,

You can try something below

for i=0 to Date(Today(),'DD/MM/YYYY')-(Date+Interval)

...

..

Next i;

didn't understood your statement. (Date+ Interval) + Interval ) for next check date.

HTH

Sushil

CELAMBARASAN
Partner - Champion
Partner - Champion

You can try something like this

Load

     Date,

     Interval,

     Date + (Interval * iterNo()) AS Next_Check_Date

FROM .....

While (Date + (Interval * iterNo())) < Today();

Not applicable
Author

I'll Explain, My Date Values should keep on incrementing according to the Intervals until it crosses the current date.

Hope its understood.

sushil rathore wrote:

Hi,

You can try something below

for i=0 to Date(Today(),'DD/MM/YYYY')-(Date+Interval)

...

..

Next i;

didn't understood your statement. (Date+ Interval) + Interval ) for next check date.

HTH

Sushil

Not applicable
Author

Ur logic is exactly what i want But its not working

CELAMBARASAN
Partner - Champion
Partner - Champion

Can you post your script? So that I can take a look for the issue.

Not applicable
Author

I just took a sample ,

Int:

LOAD Date + (Interval * iterNo()) AS Next_Check_Date

INLINE [

    Date, Interval

    20/5/2014, 700

    21/5/2014, 30

    22/5/2014, 3    

];

While (Date + (Interval * iterNo())) < Today();

CELAMBARASAN
Partner - Champion
Partner - Champion

Both while and load statement are single statement. Don't split it

Int:

LOAD Date + (Interval * iterNo()) AS Next_Check_Date

INLINE [

    Date, Interval

    20/5/2014, 700

    21/5/2014, 30

    22/5/2014, 3   

]

While (Date + (Interval * iterNo())) < Today();

Not applicable
Author

doesnt make a difference, I tried by taking resident load as well,

CELAMBARASAN
Partner - Champion
Partner - Champion

Can you check whether the date format mentioned to the variable is same as that are in the inline table?

SET DateFormat='DD/MM/YYYY';