Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hi,
I am trying to create some custom queries in order to display results of the thing's properties. I am following the format mentioned in another thread here as How to query form infotable using query function?
Like that thread I also want to execute similar sort of thing where Speed >'20' and id=1.
However, when executing the service, I get the error as Wrapped java.lang.NullPointerException Cause: null.
var query = {
"filters": {
"type": "AND",
"filters": [
{
"fieldName": "Speed",
"type": "GT",
"value": "20"
},
{
"fieldName": "ID",
"type": "EQ",
"value": "1"
}
]
}
};
var params = {
t: result /* INFOTABLE */,
query: query
};
var result = Resources["InfoTableFunctions"].Query(params);
Please do let me know what may have been the error in the code/process and what could be the possible solution?
Thanks!
P.S. I am keeping the output of the service as InfoTable
For id=1 it's "EQ" condition not "LT"
Hi,
That was a typo here in the question (I corrected it now). I corrected it and tried it but the same error is displayed again.
I'm not sure if that's the reason, but try values without " as it are Number/Integer values
Also check if ti's Case Sensitive, on the where condition sample you wrote id and on the Query you wrote ID
I have inserted the code through the snippets and hence the values of the fieldname are directly taken from the name of the properties. The example which I gave in my question statement was written just to introduce the problem.
I have also tried querying with just one fieldname but it throws the same error.
And which it's the content of the parameter t: result ( I mean previous result value )
This t:result , I am not sure what exactly it does, since I am just checking out the functionality by using the code provided in the thread How to query form infotable using query function?
That's the problem, input value t it's the table that you want to filter with the Query, if result it's null that's the reason that it fails.
OK, I understand. Can you maybe suggest a correct syntax for the code?
The code it's correct, the problem it's that you don't have an input Table where to query.
Ok, so my properties are stored in Value Streams, does this functionality work with those?
Any infotable content ( Stream, Value Stream, Infotable Property,...)
Ok, so I have a value stream VS1 containing the properties which I want to query. So what should be the syntax to include that in the code and make sure that it takes the values from VS1. I am a little new to this and hence some of my concepts may not be clear enough.
Thanks!
I think better you go through Training or documentation to learn about how data it's organized on TW and how to query it.
Hey,
Thanks for the quick response. I did try without " and with ' as well but nope, same error