Skip to main content
Sep 27, 2022 7:27 AM UTC
Solved

how to use NOTLIKE query Filter ?

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,

Sep 27, 2022 9:41 AM UTC

Try value as below,

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

4 replies

Sep 27, 2022 9:41 AM UTC

Try value as below,

var query = {
 "filters":{
 "type": "NOTLIKE",
 "fieldName": "Name",
 "value": "Test question*"
 }
}; 
Sep 27, 2022 11:06 AM UTC

Hi @Sathishkumar_C,

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

Thanks,

Sep 27, 2022 12:14 PM UTC

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

,  

Sep 30, 2022 11:43 AM UTC

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.