Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hi,
I have two services. One contains all data(One of the columns is a number which is got from SQL query) and another service which is used to convert the number to DateTime(Javascript). Now i would like to modify all numbers to DateTime using another service. Is it possible? Please, anyone, help me out on this.
Regards,
Surekha N.
Solved! Go to Solution.
// use first service result: DATETIME as input to second service
var input = me.GetDateTimePropertyValue({
propertyName: me.lastConnection/* STRING */
});
// result: INFOTABLE dataShape: "DateTimeValueStream"
var result = me.QueryDateTimePropertyHistory({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
propertyName: undefined /* STRING */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: input /* DATETIME */
});
You can only return one result in the script but you can call several services inside. just use add service - entities to find the service you want.
var params = {
propertyName: undefined /* STRING */,
value: undefined /* DATETIME */,
timestamp: undefined /* DATETIME */
};
// no return
Things["azureRhel-AnalyticsServer"].AddDateTimeValueStreamEntry(params);
var params1 = {
property: undefined /* STRING */,
message: undefined /* STRING */
};
// no return
Things["azureRhel-AnalyticsServer"].AcknowledgeAlert(params1);
These 2 services won't interfere with each other, so they can run in order.
// use first service result: DATETIME as input to second service
var input = me.GetDateTimePropertyValue({
propertyName: me.lastConnection/* STRING */
});
// result: INFOTABLE dataShape: "DateTimeValueStream"
var result = me.QueryDateTimePropertyHistory({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
propertyName: undefined /* STRING */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: input /* DATETIME */
});
This consists of 2 separate services, use first result as second service input