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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Not Equal filter of info table query is not working.

dev_1827
10-Marble

Not Equal filter of info table query is not working.

var query2 = {
"filters":
{
"type": "OR",
"filters": [{
"type": "NE",
fieldName: "name",
value:"ConsolidatedInfoFiles"
},
{
"type": "NE",
fieldName: "name",
value:"Health Summary"
},
{
"type": "NE",
fieldName: "name",
value:"Shiftwise Melt Consumption"
},{
"type": "NE",
fieldName: "name",
value:"Shiftwise Energy Consumption"
}
]}
};
var params1 = {
t: infoIT /* INFOTABLE */,
query: query2 /* QUERY */
};
var result = Resources["InfoTableFunctions"].Query(params1);

ACCEPTED SOLUTION

Accepted Solutions

I found the solution. NE filter will work with AND filter thats the reason NE filter didn't work with OR (Demorgans law-¬(PQ)¬(PQ)

View solution in original post

11 REPLIES 11
DanZ
15-Moonstone
(To:dev_1827)

Can you provide more information? I.e. how your data looks like? What is the expected and what is the actual result?

dev_1827
10-Marble
(To:DanZ)

input is info table. we are query the infotable based on name .the result is also a info table

DanZ
15-Moonstone
(To:dev_1827)

I mean the content of the infotable. You try to query data with the above mentioned filter. What is the result? Do you get to many rows or none? Can you provide a specific example? Then it would be possible to reproduce the scenario.

dev_1827
10-Marble
(To:DanZ)

The input Info table is of length 528 rows after the query it should return Info table of  length 396 rows ,but it gives the output of info table of 528 rows .It means the query hasn't worked on the info table .I want to know why this is happening.

Hi @dev_1827 ,

Without an specific example (which means the input infotable, the query, and the expected and actual output) it is almost impossible to help you effectively.

The only thing I saw strange is the fact that for some keys you use quotes, and for some you do not. Was this intented?

which are the keys you are talking about?

If you check the JSON for yourself you will see that all fieldName and value don't have quotes.

I am not sure if this would impact or not the query, but it's something you should try quickly.

VladimirRosu_0-1652164557652.png

 

If that was the reason, the same query should have not been worked for Equal to filter of query .Right?. Although I have even tried it with the quotes it didn't work.

Why does  the same query works for equal to(EQ) filter but not for not equal(NE) filter?

I was not aware that it worked for EQ filter - you never mentioned before this.

But now that I'm looking at your query in the morning, I believe the result that you see is the expected output.

Let's start from the beginning: with the OR logical operator, each infotable row will be checked so that at least one of the conditions there is satisfied.

The condition in the NE case is "field 'name' should not have value 'xyz...' "

  • If you have a row name that contains any of the values, that row will pass the criteria, because at least one row name is not equal to the values you passed.
  • If you have a row name that does not contain any of the values, that row will again pass the criteria, because none of the row names are not equal to the values you passed.

Meaning that your query basically will return all the infotable, each time.

The condition in the EQ case is "field 'name' should be equal to value 'xyz...' ":

  • If you have a row name that contains any of the values, that row will pass the criteria, because at least one of the values is equal to the values you passed.
  • If you have a row name that does not contain any of the values, that row will not pass the criteria, because none of the row names are equal to the values you passed.

 

Can you please elaborate more on NE filter with OR logical operator ?

I didn't get the point you are trying to explain me.

I found the solution. NE filter will work with AND filter thats the reason NE filter didn't work with OR (Demorgans law-¬(PQ)¬(PQ)

Announcements


Top Tags