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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Anyone used the scheduler in 8.5 version.

sagarmemane92
11-Garnet

Anyone used the scheduler in 8.5 version.

I am trying to used the scheduler but unfortunately my subscription not called for scheduler .Didn't get the exact solution while digging it.

Need help !!

 

 

Thanks in advance 

1 ACCEPTED SOLUTION

Accepted Solutions

Well, it depends on what you put in the timestamp field when you save data in that datatable.

 

One way to troubleshoot it is by opening this datatable in Composer and go to its Mashup -- this will give you a preview of what's inside. 

 

Also try to wrap filters into an array, like this:

"filters": [{

 

Finally, in 90% of cases you should use Streams or ValueStreams instead of DataTables -- they are indexed by timestamp and thus optimized for such kind of queries. Your data table will start slowing your system down after it receives few thousands of records, which usually happens very soon.

 

/ Constantine

View solution in original post

9 REPLIES 9

Hi @sagarmemane92.

 

I'm not clear on the issue.  Can you please provide more details.  Are you getting an error?  Screenshots may be helpful.

 

Regards.

 

--Sharon

Hey Slangley,

 

I want to send the data automatically.I am using the data table .In service i am fetching the data and in subscription i am sending trying to send the data in html format through mail.But unfortunately my subscription not calling .I don't exactly error.(Script log- Error in: EMS_Scheduler_Sagar.Weekly_PF_Report javascript service)

Here I am attaching the service and subscription file 

 

 

Thanks in advance 

 

Sagar

 

Hello Sagar,

 

Here, in the very first line you should use "logger" instead of "Logger":

Logger.warn("Gandtay");

 

/ Constantine 

Hey Constantine,

 

Its working . in there i need to change my HTML code little bit , So i will do that

 

Thanks For Help and quick response

 

 

 

Thanks  and regard

Sagar Memane

Hi Constantine,

I have written below code to take the data daily,weekly and monthly ,but it doesn't work.It shows all the data of data table.

Can you help me in this

 

var days=7; // Days you want to subtract
var currentdate = new Date();
var lastDate = new Date(currentdate.getTime() - (days * 24 * 60 * 60 * 1000));
var day =lastDate.getDate();
var month=lastDate.getMonth()+1;
var year=lastDate.getFullYear();
var myquery =
{
"filters": {
"type": "Between",
"fieldName": "timestamp",
"from": lastDate,
"to": currentdate
}
};

var result = Things["ProductionLine_Data"].QueryDataTableEntries({
maxItems: undefined /* NUMBER */,
query: myquery /* QUERY */,
values: undefined /* INFOTABLE */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});

 

 

Thanks 

Sagar

  

Well, it depends on what you put in the timestamp field when you save data in that datatable.

 

One way to troubleshoot it is by opening this datatable in Composer and go to its Mashup -- this will give you a preview of what's inside. 

 

Also try to wrap filters into an array, like this:

"filters": [{

 

Finally, in 90% of cases you should use Streams or ValueStreams instead of DataTables -- they are indexed by timestamp and thus optimized for such kind of queries. Your data table will start slowing your system down after it receives few thousands of records, which usually happens very soon.

 

/ Constantine

Hey Constantine,

 

Thanks for help

 

Regards,

Sagar

Hello @sagarmemane92 ,

 

  1. Make sure that the Scheduler is enabled;
  2. Make sure that the Subscription is enabled;
  3. Make sure the Scheduler executes under a user with sufficient access rights. For testing try Administrator;
  4. Check your cron string (ThingWorx syntax is not 100% compatible with that of the classic cron);

/ Constantine

Hi Constantine,

 

 Thanks For feedback ,

 

But i already did this changes.But still my subscription is not calling.Even in subscription Logger.warn("error); is also not working

 

I am attaching mu service and subscription here.

 

Regards

Sagar

Top Tags