Skip to main content
pshashipreetham
19-Tanzanite
Jul 16, 2022 3:27 PM UTC
Solved

Filters for the Datashape Query is not working

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.

nmillesonAnswer
17-Peridot
Jul 20, 2022 12:32 PM UTC

@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
Jul 20, 2022 12:32 PM UTC

@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

Translate