cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

next scheduler executions / CRON

gch
13-Aquamarine
13-Aquamarine

next scheduler executions / CRON

Hello,

 

I need a functionality to determine the next execution date(s) of a scheduler based on it's cron and last execution date (or date range) but I could not find anything useable in Thingworx or Java. Having this capability I could provide an overview of the scheduled task to the End user.

Is there any tool that could help me to achieve this?

ACCEPTED SOLUTION

Accepted Solutions
danmorin
12-Amethyst
(To:gch)

Hi 

 

Manually you can get the last execution date by creating a date time property that will be updated when the scheduler is triggered. That way it will keep the last execution date.

 

For the next execution date, you can get the cron schedule via service

 

let table = me.GetConfigurationTable({
tableName: 'Settings' /* STRING */
});
let result = table.schedule;

 

and then from the result you can create a function to determine the next execution date

 

Hope this helps, thanks

View solution in original post

4 REPLIES 4
danmorin
12-Amethyst
(To:gch)

Hi 

 

Manually you can get the last execution date by creating a date time property that will be updated when the scheduler is triggered. That way it will keep the last execution date.

 

For the next execution date, you can get the cron schedule via service

 

let table = me.GetConfigurationTable({
tableName: 'Settings' /* STRING */
});
let result = table.schedule;

 

and then from the result you can create a function to determine the next execution date

 

Hope this helps, thanks

gch
13-Aquamarine
13-Aquamarine
(To:danmorin)

Yes it does, but we cannot findout the execution date in the future, for instance for next month?

danmorin
12-Amethyst
(To:gch)

You need to make the logic by yourself to count the next date. or use this API calls which may help you https://docs.cron-job.org/rest-api.html https://cron-job.org/en/ 

gch
13-Aquamarine
13-Aquamarine
(To:danmorin)

Alright thank you for the quick answers!

Announcements


Top Tags