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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Query "IN" filter

ague
12-Amethyst

Query "IN" filter

Trying to do exactly the same thing and I'm getting an issue.

 

I'm querying a datatable, and passing this query (below). If I run the QueryDataTable entries with this query, it returns no results. If I just change the Station parameter to be "EQ" and just add the machine name as a string, the query works as expected (returning 40+ results). 

 

What gives? What am I doing wrong?

 

 

 

 

 

var machineArray = ['my_machine_name'];

 

var query = {
"filters": {
"type": "And",
"filters": [
{
"type": "IN",
"fieldName": "Station",
"value": machineArray
},
{
"type": "EQ",
"fieldName": "Program",
"value": Transmission
},
{
"type": "EQ",
"fieldName": "Operation",
"value": Operation
}]}};

 

var myQueryResults = Things["Ford.PFS.GM.Historian.Repository"].QueryDataTableEntries({
maxItems: 200000 /* NUMBER */,
values: undefined /* INFOTABLE */,
query: query /* QUERY */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});

1 ACCEPTED SOLUTION

Accepted Solutions
slangley
23-Emerald II
(To:ague)

Hi @ague.

 

Per the information in the case, it appears the issue was the result of a typo:

 

"filters": [

{

"type": "IN",

"fieldName": "Station",

"values": machineArray

},

 

If you are in agreement that this was the solution, please mark this response as the Accepted Solution for the benefit of others on the community.

 

Regards.

 

--Sharon

 

View solution in original post

2 REPLIES 2
slangley
23-Emerald II
(To:ague)

Hi @ague.

 

It appears that a case was created for this, so we will update the solution here once it is known.

 

Regards.

 

--Sharon

slangley
23-Emerald II
(To:ague)

Hi @ague.

 

Per the information in the case, it appears the issue was the result of a typo:

 

"filters": [

{

"type": "IN",

"fieldName": "Station",

"values": machineArray

},

 

If you are in agreement that this was the solution, please mark this response as the Accepted Solution for the benefit of others on the community.

 

Regards.

 

--Sharon

 

Top Tags