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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

QueryPropertyHistory Service Message :: Null

Diveye
6-Contributor

QueryPropertyHistory Service Message :: Null

Hello! 

I'm running a very simple QueryPropertyHistory Service to obtain the logged values that are defined on the very Thing on which the service is defined. So normally something like this should work? 

 

// result: INFOTABLE dataShape: ""
var result = me.QueryPropertyHistory({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: undefined /* DATETIME */
});

 

I set up my service to run on Mashup load just to test it out and I get this error (in the console log):

 

Error executing service. Message ::null - See Script Error Log for more details

 

There are no additional details provided in the Error Log, it's actually completely blank. Does anyone know how to properly query all the properties present on the same Thing as the service it is being ran on? 

 

Any help will be much appreciated. Cheers!

1 ACCEPTED SOLUTION

Accepted Solutions
cmorfin
19-Tanzanite
(To:Diveye)

Hi @Diveye 

 

Yes you do ned a vlaueStream, this is what QueryPropertyHistory service is querying, so without one, it is expected that it does not work.

See Using the QueryPropertyHistory service in Help Center, the first sentence is "The QueryPropertyHistory service queries the value stream for each property (must be a logged property) value of the given source thing in a given time range"

 

In practice you should be able to do this very simply:

- create a new ValueStream

- Associate it to your Thing (in General information page)

- then set some new values to your properties (the previously set values were not actually logged since you did not have a valuestream).

- then run your service to check.

 

Kind regards

Christophe

 

View solution in original post

4 REPLIES 4
cmorfin
19-Tanzanite
(To:Diveye)

Hi @Diveye 

 

Yes I tested your code and it works fine for me in 8.4.1.

Maybe it would be worth checking the basics:

- do you have a valueStream associated to the Thing ?

- are the properties logged ?

if not, set those and reset some values for the properties, then try the service.

Also try the service from the service menu of the Thing rather than a mashup to remove any additional layer where issue could get in.

 

Hope this helps

kind regards

Christophe

 

Diveye
6-Contributor
(To:cmorfin)

Hello Christophe,

 

Thank you for your reply. My values are logged and they are defined in the properties section of the Thing that I am using to run the QueryPropertyHistory service. I do not have a value stream defined, do I need to make one? If so, do I need to then place all my values within it? 
I have a QueryPropertyHistory loaded directly in the mashup (not defined as a service), and it seems to be working very well so far, so I'm supposing I should be able to do this without having to migrate my properties elsewhere correct? 

 

Thanks!

cmorfin
19-Tanzanite
(To:Diveye)

Hi @Diveye 

 

Yes you do ned a vlaueStream, this is what QueryPropertyHistory service is querying, so without one, it is expected that it does not work.

See Using the QueryPropertyHistory service in Help Center, the first sentence is "The QueryPropertyHistory service queries the value stream for each property (must be a logged property) value of the given source thing in a given time range"

 

In practice you should be able to do this very simply:

- create a new ValueStream

- Associate it to your Thing (in General information page)

- then set some new values to your properties (the previously set values were not actually logged since you did not have a valuestream).

- then run your service to check.

 

Kind regards

Christophe

 

Diveye
6-Contributor
(To:cmorfin)

Hello again,

 

Adding a new value stream to the thing that was running the services solved my problem! Said thing was currently using a value stream of another project, which explains why the query property history snipped was not working correctly on it (and why my values appeared as logged on the charts I was drawing). 

 

Thanks for the help!

Top Tags