cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Data Filter widget Query

UY_9515947
6-Contributor

Data Filter widget Query

Hi,

I am new to ThingWorx Environment.

I did some research on TW Community and based on that I Configured my DATA FILTER Widget.

I put the following codes in my Service:

var params = {
t: Things["SQL_Connection_Testing_DB_Udit"].sql_Output() /* INFOTABLE */,
query: Query /* QUERY */
};
// result: INFOTABLE
var result = Resources['InfoTableFunctions'].params.query;

 

Till now my assumption is that the Query from Data Filter widget will pass on to the input Query of my service and that query in turn will execute the DataTable which I provide under "t" Variable.

 

But somehow I am getting the following error :

Error executing service Service101. Message :: TypeError: Cannot read property "query" from undefined - See Script Error Log for more details.

 

i am guessing, i am doing something wrong with Service query part. DO I need to write any more query than what I mentioned earlier, If yes, Please help me with what kind of structure the query should follow, Considering I want filter 4 Column of Data ?

Please help me with this.

@raluca_edu @posipova @slangley 

 

Thanks in Advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jensc
17-Peridot
(To:UY_9515947)

Hello,

 

In case someone comes across this post here is one way you can do what you want to achieve:

 

 

 

// Provide your filter using the format as described in the help topic "Query Parameter for Query Services"
let query = {
 "filters": {
   "type": "EQ",
   "fieldName": "name",
   "value": "<name to filter>"
 }
};

let params = {
	t: "YourInfoTable" /* INFOTABLE */,
	query: query /* QUERY */
};

// result: INFOTABLE
let result = Resources["InfoTableFunctions"].Query(params);

 

 

 

The query JSON would need to be modified to what you want to query of course. You can read more on how different queries can be built here.

 

Regards,

Jens

View solution in original post

1 REPLY 1
jensc
17-Peridot
(To:UY_9515947)

Hello,

 

In case someone comes across this post here is one way you can do what you want to achieve:

 

 

 

// Provide your filter using the format as described in the help topic "Query Parameter for Query Services"
let query = {
 "filters": {
   "type": "EQ",
   "fieldName": "name",
   "value": "<name to filter>"
 }
};

let params = {
	t: "YourInfoTable" /* INFOTABLE */,
	query: query /* QUERY */
};

// result: INFOTABLE
let result = Resources["InfoTableFunctions"].Query(params);

 

 

 

The query JSON would need to be modified to what you want to query of course. You can read more on how different queries can be built here.

 

Regards,

Jens

Top Tags