Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 7 Next »

Selector Built-in Functions

These functions are available via the object's namespace, e.g. Person:{function}.

They can be used to read sets of data from the persistence layer. The final four in the table below (union, diff, intersect, and and) can be used to build up a complex selector using a combination of other selector BIFs as parameters. The other selectors all take an object's attribute as first parameter, and one or more values as the next parameter(s).

FunctionSyntaxDescriptionExample
allObj:all()returns all records from the tablePerson[] plist = Person:all();
equalsObj:equals(a,b)

returns records with value of obj.a equal to b

Person[] plist = Person:equals(deleted, false);
notEqualsObj:notEquals(a,b)returns records with value of obj.a not equal to bPerson[] plist = Person:notEquals(deleted, true);
emptyObj:empty(a)returns records with obj.a equal to nullPerson[] plist = Person:empty(mobileNum);
betweenObj:between(a,x,y)returns records with value of obj.a within the range of values between x and yPerson[] plist = Person:between(dob, date1, date2);
lessThanOrEqual
Obj:lessThanOrEqual(a,b)returns records with value of obj.a less than or equal to bPerson[] plist = Person:lessThanOrEqual(age, num);
lessThanObj:lessThan(a,b)returns records with value of obj.a less than bPerson[] plist = Person:lessThan(age, num);
greaterThanObj:greaterThan(a,b)Check if value is greater than the value being compared toPerson[] plist = Person:greaterThan(age, num);
attributeInObj:attributeIn(a,"x,y,z")Attribute InPerson[] plist = Person:attributeIn(state, "Any, One, Of, These");
relationshipInObj:relationshipIn(a,b)Relationship InPerson[] plist = Person:relationshipIn(reportsTo, person);
containsObj:contains(a,b)Check is collection has element(s)Person[] plist = Person:contains(name, "a");
beginsWith Begin withPerson[] plist = Person:beginsWith(name, "a");
endsWith End withPerson[] plist = Person:endsWith(name, "a");
notEmpty Not emptyPerson[] plist = Person:notEmpty(mobileNum);
notBetween Not between the data or elementsPerson[] plist = Person:notBetween(dob, date1, date2);
notContains Collection does not contain element(s)Person[] plist = Person:notContains(name, "a");
notBeginWith Not begin withPerson[] plist = Person:notBeginWith(name, "a");
notEndsWith Check if value does not end with value being compared toPerson[] plist = Person:notEndsWith(name, "a");
notAttributeIn Attribute not in the given domainPerson[] plist = Person:notAttributeIn(state, "Any, One, Of, These");
notRelationshipIn Use to check for relationshipPerson[] plist = Person:notRelationshipIn(reportsTo, person);
union UnionPerson[] plist = Person:union(equals(rating, "good"), equals(rating, "excellent"));
diff Use to check for differencesPerson[] plist = Person:diff(equals(), equals());
intersect IntersectPerson[] plist = Person:intersect(equals(deleted, false), equals(active, true));
and And (in most cases, use this rather than intersect)Person[] plist = Person:and(equals(deleted, false), equals(active, true));

 

 

 

 

Data Subsets

Having populated a collection with a selector BIF, you can further refine your selection by assigning a subset of said collection to a new collection by using the select BIF. This BIF is available via the collection variable and takes one or a combination of the above selector BIFs as parameter. See the Collections for details.

 

 

Additional Mentions and References

 

 

 

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.