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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Sagar082
Creator
Creator

Need help on following code

Hi folks,

Greeting for the day.

I define two variable in the script like;

Let ThisExecTime = Now( );

Let LastExecTime = ThisExecTime;

I'm trying to compare it with the following code;

where Minute(Time($(ThisExecTime), 'HH:MM:SS') -time( $(LastExecTime), 'HH:MM:SS') >59;

The object is that respective table should load if the current time is more than 59 minutes as compared to last executed time.

I'm getting following error;

where Minute(31/10/2020 >>>>>>12<<<<<<:31:56 PM - 31/10/2020 12:11:51 PM) >59

Can someone help me on this. Also, if the data format of the variables are different then how I can align them.

Regards,

Sagar.

3 Replies
rubenmarin

Hi @Sagar082, Now() returns a timestamp, you can use Minute(Timestamp('$(ThisExexTime)')) or Minute(Timestamp#('$(ThisExexTime)','DD/MM/YYYY hh:mm:ss tt')).

Two comments ofyour expression:

 - Need to enclose $(LastExecTime) to ensure it's readed as a date, and not doing the divison (31 divided by 10 divided by 2020...).

- Use mm instead of MM for time format, MM means months while mm is minutes; using MM in Time() function can return unexpected results

Sagar082
Creator
Creator
Author

Hi Rebenmarin,

Greeting for the day. Thank you for reply. But, I sorted of by own in the same when you explain but, the syntax is little bit different;

where Minute($(vRunTime)) > 59 + Minute($(vLastRunTime));

I used the above statement, so it is working out for me. 

But I'm facing a logical error challenge.  As my vRunTime = Num(Now()) and I defined

Let vLastRunTime = vRunTime;

So, my load will never happened which I just figure it out. Can you help on it. I need the vLastRunTime should only updated if "Minute($(vRunTime)) > 59 + Minute($(vLastRunTime))" is True.

Not necessary I'm insisting on if, but any logic can work. Only the criteria is data should load after every 1hr.

Once again thanks for reply. Awaiting some positive response

Regards,

Sagar.

Sagar082
Creator
Creator
Author

Hi Rebenmarin,

Also, I need on another challenge, as soon as the app is close the variable; vLastRunTime , losing its stored value.

I would like to know Is there any way I can write that to data table. So, I'm planning to make a new column and right that timestamp in all rows.

Please guide me on it.

Regards,

Sagar.