Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
DiegoF
Creator
Creator

Display ReloadTime as a substraction with the last ReloadTime as a String

Hello Qlik developers,

I know more or less how ReloadTime works and how it displays it. But I want to show something like: Last Reload Time was 5 minutes ago, or 2h and 35 mins ago... instead of the usual Date format it displays.

Is this possible?

Thanks.

Labels (3)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

You can try to use an expression like (interval(now() - ReloadTime()))

example:

amartinez35_0-1661935866737.png

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

5 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

You can try to use an expression like (interval(now() - ReloadTime()))

example:

amartinez35_0-1661935866737.png

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
DiegoF
Creator
Creator
Author

Hi thanks for the response!

It does work but can it also be applied for days? I mean, if its more than a day, the hour should be something like 24 or more. Is there a function to solve this or should I just use a If clause as to substract when it pass 24 and put a 1 or something like that?

I have this for hours and minutes:

= 'Actualizado hace ' &
If(Hour(Interval(Now() - ReloadTime())) > 0, Hour(Interval(Now() - ReloadTime())) & ' h y ' & Minute(Interval(Now() - ReloadTime())) &' min',
Minute(Interval(Now() - ReloadTime())) &' min')

And this is what it shows (I guess it will still work if there are hours):

DiegoFraj_0-1661940194780.png

Thanks!

Or
MVP
MVP

There aren't any built-in functions to translate an interval into an language-specific text representation such as "Two days, five hours, seventeen minutes and three seconds". You can format an interval along the lines of 'D:hh:mm:ss' though.

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

I tied to add second parameter like 'd h m s' and I think that display day hour minute second

 

Interval((now()) - ReloadTime(), 'd h m s')

Help users find answers! Don't forget to mark a solution that worked for you!
DiegoF
Creator
Creator
Author

Sorry I have a last thing, I don´t know if it has a solution or not, but I use this expression with minute (= Minute(interval(now() - ReloadTime())) & ' minutes') on the object that reloads your app, so when I push the button, it reloads the app, but instead of showing me 0 minutes, it shows me 59 minutes. If I F5 the page at the instant it will show correctly the 0 minute, but only if i refresh.

DiegoFraj_0-1662711314030.png

Green means it just refreshed cuz I pushed the button.

I kinda know why could it happen but I don´t know how to solve this, Can I add like 1 or 2 seconds? Or is this not the solution.

 

Thanks.