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

Cannot call method QueryPropertyHistory of null

Highlighted

Cannot call method QueryPropertyHistory of null

hey there,

I want to retrieve the value history of all the properties, but in the application log I get following error:

[context: com.thingworx.webservices.context.HttpExecutionContext@6cea85f4][message: Execution error in service script [AC_helper getACContaminationHistory] : TypeError: Cannot call method "QueryPropertyHistory" of null (getACContaminationHistory#17)]

This is what my function "getACContaminationHIstory" looks like: (the output is an infotable(with all of my properties the thing has) and the input is a string (ACtag)

var params = {

identifier: ACtag /* STRING */

};

// result: THINGNAME

var thingname = Resources["EntityServices"].GetThingNameForIdentifier(params);

var params1 = {

    oldestFirst: true /* BOOLEAN */,

    maxItems: 1000 /* NUMBER */,

    endDate: undefined /* DATETIME */,

    query: undefined /* QUERY */,

    startDate: undefined /* DATETIME */

};

// result: INFOTABLE

var result = Things[thingname].QueryPropertyHistory(params1);

Any suggestions? Thank you in advance!

Theresa

Tags (1)
4 REPLIES 4

Re: Cannot call method QueryPropertyHistory of null

Hi Theresa, sorry for the basic question, does the variable thingname gets it's required value? May be have that surrounded with try/catch block to check?

Re: Cannot call method QueryPropertyHistory of null

Hey Sushant Pandey​,

the variable thingname is definitely getting the right value. I have already tested the function with a valid thingname input and what I am getting is

a empty result table:

Re: Cannot call method QueryPropertyHistory of null

Do you set your property's "Aspects" parameter in "logged"?

Re: Cannot call method QueryPropertyHistory of null

hey yz ding​,

yes, the properties are logged.