Skip to main content
18-Opal
July 16, 2022
Solved

Filters for the Datashape Query is not working

  • July 16, 2022
  • 1 reply
  • 1384 views

Adding filters to the Datashape Query, how should it be done ?
As of now I am using following code..

var queryToAvoidPowderMixTables = {
 "filters":{
 "type": "NE",
 "fieldName": "Source",
 "value": "Powder_Mix"
 }
}; 

var params = {
 filter: filter,
 dataShapeName: "PTC.SCA.SCO.MaterialDefinition",
 offset: offset,
 limit: limit,
 query: queryToAvoidPowderMixTables
};

var MaterialDefinitions = Things["PTC.SCA.SCO.PostgresDatabase"].Query(params);
MaterialDefinitions.Sort({ name: "UID", ascending: false });

but the query for "Power_Mix" is not working..

Thanks,
Shashi.

Best answer by nmilleson

@pshashipreetham ,

 

It looks like you might need to form your JSON a bit differently.  See here:

 

https://support.ptc.com/help/thingworx/apps/r9.1/en/#page/thingworx_apps/Customizing_Operator_Advisor/using_JSON_filters.html

 

Hope that helps,

Nick

1 reply

nmilleson17-PeridotAnswer
17-Peridot
July 20, 2022

@pshashipreetham ,

 

It looks like you might need to form your JSON a bit differently.  See here:

 

https://support.ptc.com/help/thingworx/apps/r9.1/en/#page/thingworx_apps/Customizing_Operator_Advisor/using_JSON_filters.html

 

Hope that helps,

Nick