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

How to call one service in another service using java script?

SOLVED
Highlighted
Amethyst

How to call one service in another service using java script?

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to call one service in another service using java script?

// 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 */
});

5 REPLIES 5

Re: How to call one service in another service using java script?

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.

Re: How to call one service in another service using java script?

Hi @zyuan1 ,

     I want to pass one service data to another service here.

 

Regards,

Surekha N.

Re: How to call one service in another service using java script?

// 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 */
});

Re: How to call one service in another service using java script?

This consists of 2 separate services, use first result as second service input

Re: How to call one service in another service using java script?

Hi @Surekha.

 

If the responses provided by @zyuan1 answered your question, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon