Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello Community,
I've been trying to figure out how to use the "select" key in the JSON query functionality of QueryStreamData...
me.QueryStreamData({
// oldestFirst: undefined /* BOOLEAN */,
// maxItems: undefined /* NUMBER {"defaultValue":500} */,
// sourceTags: undefined /* TAGS */,
// endDate: undefined /* DATETIME */,
// query: undefined /* QUERY */,
// source: undefined /* STRING */,
// startDate: undefined /* DATETIME */,
// tags: undefined /* TAGS */,
// });
However I haven't had any luck...
There is no datashape returned for this service, and even if there was one, I'm not entirely sure I could get it to work.
I have do have a datashape for the stream of course, and I did try to use that using the following query:
"select": [
{
"dataShapeName": "MyDataShape",
"fieldName": "FieldName"
}
]
But that didn't work either.
I also tried just querying everything from my stream and doing an infotable query:
let test = DataShapes["MyDataShape"].CreateValuesWithData({
values: { values },
});
// Provide your filter using the format as described in the help topic "Query Parameter for Query Services"
let query = {
"select": [{
"dataShapeName": "MyDataSHape",
"fieldName": "FieldName",
}],
};
let params = {
t: test /* INFOTABLE */,
query: query /* QUERY */,
};
result = Resources["InfoTableFunctions"].Query(params);
But this also didn't work... Anyone got any idea of what I am doing wrong?
Or that has done this with success before?
Any help would be highly appreciated!
Thanks,
Jens C.
Solved! Go to Solution.
Ah, Operator Advisor, I wondered where you got the "select" idea from. Yeah, that's OA only, different implementation since the OA entities use different templates/classes. RemoveField is probably the easiest solution.
There is no "select" field in the query there is only sorts and filters, as documented in the help topic "Query Parameter for Query Services" as well as in the QueryStreamData Service Info:"Query stream data (no stream entry details), along with filter and sort criteria".
You will get back rows according to the DataShape you assigned to the Stream,
Ah, Operator Advisor, I wondered where you got the "select" idea from. Yeah, that's OA only, different implementation since the OA entities use different templates/classes. RemoveField is probably the easiest solution.
Hello @Rocko,
Yeah, I thought it would work with all "query" inputs.
In the end I went with looping over each field definition of the stream and removing it from the stream infotable if it wasn't the field name I wanted to keep.
Not sure how well it will scale, but shouldn't be an issue with the number of properties in our streams.
Thanks!
Jens C.