Skip to main content
Aug 29, 2018 1:31 PM UTC
Solved

Javascript queries

Hello Community,

I just started working on a project to optimize data updates so we started caching data from the server to thingworx itself but i do not manipulate as good javascript queries. I wanted to write a javascript service to query certain rows with partial information and i do not know what should i write in the filter to do so, to explain my problem more, let's suppose we have a row in the cached data table named Machine, the field machine has 3 base components A, b and C and i wanted the row having C= something. Can anyone help me with this, thank you so much.

supandeyAnswer
Aug 30, 2018 8:53 AM UTC

Hi @i_abidi i think this should help Query Parameter for Query Services.

 

Depending on what sort of entity you are working with to hold the cache in ThingWorx, you can use the Query in your query service. Below e.g. is from the DataTable having QueryDataTableEntries

 

// result: INFOTABLE dataShape: ""
var result = me.QueryDataTableEntries({
	maxItems: undefined /* NUMBER */,
	values: undefined /* INFOTABLE */,
	query: undefined /* QUERY */,
	source: undefined /* STRING */,
	tags: undefined /* TAGS */
});

2 replies

supandeyAnswer
Aug 30, 2018 8:53 AM UTC

Hi @i_abidi i think this should help Query Parameter for Query Services.

 

Depending on what sort of entity you are working with to hold the cache in ThingWorx, you can use the Query in your query service. Below e.g. is from the DataTable having QueryDataTableEntries

 

// result: INFOTABLE dataShape: ""
var result = me.QueryDataTableEntries({
	maxItems: undefined /* NUMBER */,
	values: undefined /* INFOTABLE */,
	query: undefined /* QUERY */,
	source: undefined /* STRING */,
	tags: undefined /* TAGS */
});
i_abidiAuthor
Aug 30, 2018 12:50 PM UTC

Thank you