Problem with service QueryNamedPropertyHistory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Problem with service QueryNamedPropertyHistory
Hello to all
I have a problem extracting data with the QueryNamedPropertyHistory service
Following is the example
I have a thing with the properties flow1 and flow2
If I extract data from the only property flow1 here is the result
If I extract data from the only property flow2 here is the result
If I pull both properties together here is the result
Why are the values duplicated?
How can I properly extract the values of both properties together?
Thanks in advance
Antonio
Solved! Go to Solution.
- Labels:
-
Troubleshooting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Antonio,
What QueryNamedPropertyHistory does it's merge both ValueStreams, and as you can note on your data the milliseconds for entries are different, then instead of creating empty values what QueryNamedPropertyHistory does it's fill with previous value when there's no value for the given timestamp.
Data on ValueStreams are stored by property, it's not a Table with a column for each property.
If you want a row for each exact timestamp then you may query one property by one ( as your first two examples ) and then Pivot both infotables with Pivot snippet.
Best Regards,
Carles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Antonio,
What QueryNamedPropertyHistory does it's merge both ValueStreams, and as you can note on your data the milliseconds for entries are different, then instead of creating empty values what QueryNamedPropertyHistory does it's fill with previous value when there's no value for the given timestamp.
Data on ValueStreams are stored by property, it's not a Table with a column for each property.
If you want a row for each exact timestamp then you may query one property by one ( as your first two examples ) and then Pivot both infotables with Pivot snippet.
Best Regards,
Carles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
OK thanks Carles.
so the only way to have both properties is to run the QueryNamedPropertyHistory service for each property and put the results into a correct infotable?
Best Regards
Antonio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Well to just query one by one, maybe better if you use "QueryNumberPropertyHistory" service instead of QueryNamedPropertyHistory, the second one it's more meant to query multiple properties in once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
sorry
but how do I define the query to go to the service?
what type of use?
var query =
{
"filters": {
"type": ????,
"fieldName": "Flow1,Flow2"
}
};
var params = {
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
propertyName: undefined /* STRING */,
endDate: data2 /* DATETIME */,
query: query /* QUERY */,
startDate: data1 /* DATETIME */
};
// result: INFOTABLE dataShape: "NumberValueStream"
var result = me.QueryNumberPropertyHistory(params);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you don't need to query data, just keep it undefined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I do not understand how to get the value of multiple properties together (flow1 and flow2) with the QueryNumberPropertyHistory service.
can you please make an example for me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
No you can't query more than one property at once with QueryNumberPropertyHistory, what I've meant it was that if you need to query one by one property instead of using QueryNamedPropertyHistory it's better to use QueryNumberPropertyHistory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
ok now it's all clear to me
thanks for everything
Best Regards
Antonio
