Skip to main content
1-Visitor
October 3, 2019
Solved

QueryPropertyHistory Service Message :: Null

  • October 3, 2019
  • 1 reply
  • 2594 views

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! 🙂

Best answer by cmorfin

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

 

1 reply

19-Tanzanite
October 3, 2019

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

 

Diveye1-VisitorAuthor
1-Visitor
October 3, 2019

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!

cmorfin19-TanzaniteAnswer
19-Tanzanite
October 3, 2019

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