Hi ,
Is it possible to change CRON in Scheduler dynamically? I have Column (DateTime) in Grid. based on This date need to set CRON in Scheduler.
Thanks
The CRON String should be contained within a configuration table called Settings
So you can use GetConfigurationTable and SetConfigurationTable services to dynamically change it.
It probably requires a RestartThing after you change it.
Hi @PaiChung ,
In SetConfigurationTable. what will be Datashape for Configuration table input?
Thanks
Use the Get service to investigate that, although usually there is a datashape matching the or kind of matching the configuration table name. Might be a system object.
Call Get Configuration Table service and update your cron and provide the same output as input to your set configuration table service.
Hi @VaibhavShinde.
If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon
Hope this helps,
/** GET SETTINGS **/
var settings = Things["Scheduler_Scheduler"].GetConfigurationTable({
tableName: "Settings" /* STRING */
});
/** UPDATE SETTINGS **/
settings.schedule = "0 0/9 * * * ?"; //Example
Things["Scheduler_Scheduler"].SetConfigurationTable({
configurationTable: settings /* INFOTABLE */,
persistent: true /* BOOLEAN {"defaultValue":true} */,
tableName: "Settings" /* STRING */
});