Skip to main content

Criteria function

evaluate#

The evaluate function takes the Map data as input and evaluates it with the reference criteria.

Syntax:

criteriaObject1.evaluate(Map data);

Returns: Boolean

Example:

criteriaObject1 = [id == 1297239];obj1.id = 1297239;obj2.id = 1297238;log criteriaObject1.evaluate(obj1); //True

and#

The and function takes a criteria Object as input and performs AND operation on it with the reference criteria and returns a criteriaObject.

Syntax:

citeriaObject1.and(Object citeriaObject2);

Returns: criteriaObject

Example:

citeriaObject1 = [id == 1297239]; log citeriaObject1.and([name == "Access card_6806"]);
//Result//ID : -1//Pattern : (1) and (2)//Conditions : {1=id::=::1297239, 2=name::is::Access card_6806}

or#

The or function takes criteria Object as input and performs OR operation on it with the reference criteria and returns a criteriaObject.

Syntax:

citeriaObject1.or(Object citeriaObject2);

Returns: criteriaObject

Example:

citeriaObject1 = [id == 1297239]; log citeriaObject1.or([name == "Access card_6806"]);
//Result//ID : -1//Pattern : ((1) and (2)) or (3)//Conditions : {1=id::=::1297239, 2=name::is::Access card_6806, 3=name::is::Access card_6807}

get#

The get function takes the Json or Map as input and gets criteria from it.

Syntax:

new NameSpace("criteria").get(Map mapVal);

Returns: criteriaObject

Example:

response = new NameSpace("criteria").get(mapVal); log response;

getContainsCriteria#

The getContainsCriteria function takes the fieldName and value gives the True if the condition is satisfied. False if the condition is not satisfied.

Syntax:

criteriaObject1.evaluate(String fieldName, String value);

Returns: Boolean

Example:

log new NameSpace("criteria").getContainsCriteria("id","1297239");