Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sagar_Apte
Contributor III
Contributor III

Timestamp with iterno() bug

Hi All,

I am trying generate timestamp for every 1 minute of interval between start date and end. I found the way of doing it but facing issue as in some scenario it is behaving strange. I am not sure if I am doing wrong , need your help.

I am running below script

 

Data:
LOAD *,
timestamp(Start_Date+MakeTime(0,IterNo()-1)) as Time
While Start_Date+MakeTime(0,IterNo()-1)<=End_Date;
LOAD * Inline [
Start_Date,End_Date
10/20/2020 10:00,10/20/2020 10:07 ];

 

 

For a interval defined above, I am getting correct output which is generating time from 10:00 to 10:07. But as soon as I put below interval with same script, it is not giving correct results.

Data:
LOAD *,
timestamp(Start_Date+MakeTime(0,IterNo()-1)) as Time
While Start_Date+MakeTime(0,IterNo()-1)<=End_Date;
LOAD * Inline [
Start_Date,End_Date
10/20/2020 11:00,10/20/2020 11:07 ];

Above script generates time only till 11:06 with missing 11:07. Not sure if it is bug or I am doing something wrong. Can you please advise?

 

 

 

 

14 Replies
jakobjosef
Creator II
Creator II

qlik_17.06.2021.JPG

 

marcus_sommer

Iterno() hasn't any inbuilt limitation else it will run as far as the while-condition is true. This means you should check this condition again if it's really based on a minute-difference between from and to.

Before - just check the set selections in your application if not any of them limit your view from the screenshot to the 8'th hour.

- Marcus

jakobjosef
Creator II
Creator II

Dear @marcus_sommer ,
thank you very much for your answer. Unfortunately I could not find the problem.
But I made a very short example, using exactly your solution, maybe you could check it  ?
This is the script :

Qlik_18.06.2021.JPG

The file is attached. I would be very happy if there is a solution to this problem. 

Greetings
Jakob

jakobjosef
Creator II
Creator II

Could it be, that "maketime" can only add 59 minutes at the "minutes-spot"? so we would need to go on with the "hour-spot"?

marcus_sommer

Yes, you couldn't use maketime() in this scenario because you didn't trigger the next hour if you reach 60 minutes - probably there would be also measures to implement such logic with maketime() but I think it would be far much complicated as necessary and therefore I suggest something like:

timestamp(floor(FromDate + (1/24/60 * (iterno()-1)), 1/24/60))

- Marcus