Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello Community,
I just got stuck on an issue and was hoping that perhaps someone here could help me.
I am using the QueryNamedPropertyHistory function for a property.
Getting this data, I want to loop it over and use each value for something.
Now, the issue I am facing is that the infotable data shape being used for the QueryNamedPropertyHistory is "dynamic".
It has the "timestamp" column and then the value column with is named after the property.
This makes it so I cant just do:
const propertyValues = Things[EntityName].QueryNamedPropertyHistory({
***params***
});
propertyValues.rows.toArray().forEach((element) => {
let propertyValue = element.value;
let propertyTimestamp = element.timestamp;
});
As the "value" column changes name based on the property name.
I know you can do something like:
Things[DynamicThing][DynamicProperty]
But is something similar possible in my use case?
Or how would you go about it?
Thanks,
Jens C.
Solved! Go to Solution.
Hello Community,
I got some help from a colleague and they said it is possible to do:
element[PropertyName]
To get the value of the JSON key.
I should've known how to use this square bracket notation!
Thanks,
Jens C.
Hello Community,
I got some help from a colleague and they said it is possible to do:
element[PropertyName]
To get the value of the JSON key.
I should've known how to use this square bracket notation!
Thanks,
Jens C.