Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
I have got infotable and i need to check that any column(having date value) is between specified start and end date. I tried one sample but it gives me error :
" Wrapped org.json.JSONException: JSONObject["type"] not found. Cause: JSONObject["type"] not found."
below is the code i tried:
var query = {
"filters": {
//type: "OR",
"filters": [
{
"fieldName": "Temperature",
"type": "BETWEEN",
"from": startDate,
"to": endDate
},
{
"fieldName": "Humidity",
"type": "BETWEEN",
"from": startDate,
"to": endDate
}
]
}
};
var recordsToDisplay = Resources['InfoTableFunctions'].Query(
{
query : query,
t : requiredRows
} );
Please help me where i am going wrong.
Solved! Go to Solution.
Hi Nisha,
I think you have two undesired slashes // in front of type: "OR".
Also type should be "type".
And one last thing, inner "filters" parameter content it's an array, then you should set it's conent with [ ] instead of { }.
You should have something like this:
var query = {
"filters": {
"type": "OR",
"filters": [
{
"fieldName": "Temperature",
"type": "BETWEEN",
"from": startDate,
"to": endDate
},
{
"fieldName": "Humidity",
"type": "BETWEEN",
"from": startDate,
"to": endDate
}
]
}
};
Hello, Nisha.
The closest I've been able to find to what you're asking for is in:
It talks about using the Query() InfoTableFunction in the Snippets tab to make the query on the InfoTable. Let me try this and see if I can find what's missing.
-- Craig A.
Hi Nisha,
I think you have two undesired slashes // in front of type: "OR".
Also type should be "type".
And one last thing, inner "filters" parameter content it's an array, then you should set it's conent with [ ] instead of { }.
You should have something like this:
var query = {
"filters": {
"type": "OR",
"filters": [
{
"fieldName": "Temperature",
"type": "BETWEEN",
"from": startDate,
"to": endDate
},
{
"fieldName": "Humidity",
"type": "BETWEEN",
"from": startDate,
"to": endDate
}
]
}
};
Thanks Carles it worked.