Skip to main content
17-Peridot
December 21, 2021
Solved

query to filter in thingtemplate services

  • December 21, 2021
  • 1 reply
  • 2059 views

Please tell me the query format to write in this tab to filter rows.

AP_9587236_1-1640089854173.png

 

Best answer by M4RC

Hello,

you can use a command like this:

{

  "filters": {

         "type": "EQ",

         "fieldName": "CustomerId",

         "value": 2

    }

}

If necessary, use this older article as a guide for the parameters (TWX 8 doc): 

http://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/#page/ThingWorx/Help/Composer/Things/ThingServices/QueryParameterforQueryServices.html

 

1 reply

M4RC14-AlexandriteAnswer
14-Alexandrite
December 21, 2021

Hello,

you can use a command like this:

{

  "filters": {

         "type": "EQ",

         "fieldName": "CustomerId",

         "value": 2

    }

}

If necessary, use this older article as a guide for the parameters (TWX 8 doc): 

http://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/#page/ThingWorx/Help/Composer/Things/ThingServices/QueryParameterforQueryServices.html

 

17-Peridot
January 4, 2022

Iam getting error when i given this query. What is the mistake here. @M4RC 

{
"filters":
{
"type": "AND",
"filters": [{
"type": "EQ",
"fieldName": "MachineName",
"value": MachineName
},{
"type": "EQ",
"fieldName": "TaskName",
"value":oldTaskName
}]
}
};

14-Alexandrite
January 4, 2022

You can try this:


{"filters":
 {
  "type": "And",
  "filters": [
     {
     "type": "EQ",
     "fieldName": "MachineName",
     "value": "MachineName"
     }, {
     "type": "EQ",

     "fieldName": "TaskName",
     "value": "TaskName"
     }

  ]

 }
}

Example for Values: 

"value": "string"

"value": 10

"value": 1.2

 

You need to remove the last ;