Skip to main content
18-Opal
September 27, 2022
Solved

how to use NOTLIKE query Filter ?

  • September 27, 2022
  • 2 replies
  • 2369 views

Hi,

I am using the following snippet, to Query on FieldName Which does not contain the "Test Question" Text in the FieldName Data

var query = {
 "filters":{
 "type": "NOTLIKE",
 "fieldName": "Name",
 "value": "Test question:\\+*"
 }
}; 


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

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

 

Even though I get an INFOTABLE with rows containing "Test Question" in the FieldName "Name"..

Where did I do wrong?

Note: I have followed Query Parameter for Query Services (ptc.com) and Picked up the snippet from there

Thanks,

Best answer by Sathishkumar_C

Try value as below,

var query = {
 "filters":{
 "type": "NOTLIKE",
 "fieldName": "Name",
 "value": "Test question*"
 }
}; 

2 replies

17-Peridot
September 27, 2022

Try value as below,

var query = {
 "filters":{
 "type": "NOTLIKE",
 "fieldName": "Name",
 "value": "Test question*"
 }
}; 
18-Opal
September 27, 2022

Hi @Sathishkumar_C,

Thanks for the Quick response, but it is not working...

Thanks,

17-Peridot
September 27, 2022

Below code is working fine for me, I don't the list of values starting with "Audit"...  and ensure the field name once..

let params = {
	maxItems: undefined /* NUMBER */,
	nameMask: undefined /* STRING */,
	type: "Thing" /* STRING */,
	tags: undefined /* TAGS */
};
let entities = Resources["EntityServices"].GetEntityList(params);// result: INFOTABLE dataShape: RootEntityList
var query = {
 "filters":{
 "type": "NOTLIKE",
 "fieldName": "name",
 "value": "Audit*"
 }
}; 
let params1 = {
	t: entities /* INFOTABLE */,
	query: query /* QUERY */
};
result = Resources["InfoTableFunctions"].Query(params1);// result: INFOTABLE

,  

12-Amethyst
September 30, 2022

Always starts from the beginning, first I would check whether the "fieldName": "Name" really exists in the table. Pay attention to upper and lower case. If there is no name as a column, this is not taken into account here either.
Next I would test "value":  "%Test question%"  .
And if what you expect doesn't come out here, give a brobe with LIKE and see what comes as an answer now.