Versions Compared
Version | Old Version 6 | New Version 7 |
---|---|---|
Changes made by | Former user |
Former user |
Saved on |
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Selector Built-in Functions
These functions are available via the object's namespace, e.g. Person:{function}
.
They can be used to build up a complex selector for reading read sets of data from the persistence layer. These BIFs are accessed via the pseudo unit with the same name as the object that is being queried eg. “Person” or “Car”
all
equals
empty
between
lessThanOrEqual
lessThan
greaterThan
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).
Function | Syntax | Description | Example |
---|---|---|---|
all | Obj:all() | returns all records from the table | Person[] plist = Person:all(); |
equals | Obj:equals(a,b) | returns records with value of obj.a equal to b | Person[] plist = Person:equals(deleted, false); |
notEquals | Obj:notEquals(a,b) | returns records with value of obj.a not equal to b | Person[] plist = Person:notEquals(deleted, true); |
empty | Obj:empty(a) | returns records with obj.a equal to null | Person[] plist = Person:empty(mobileNum); |
between | Obj:between(a,x,y) | returns records with value of obj.a within the range of values between x and y | Person[] plist = Person:between(dob, date1, date2); |
lessThanOrEqual | Obj:lessThanOrEqual(a,b) | returns records with value of obj.a less than or equal to b | Person[] plist = Person:lessThanOrEqual(age, num); |
lessThan | Obj:lessThan(a,b) | returns records with value of obj.a less than b | Person[] plist = Person:lessThan(age, num); |
greaterThan | Obj:greaterThan(a,b) | Check if value is greater than the value being compared to | Person[] plist = Person:greaterThan(age, num); |
attributeIn | Obj:attributeIn(a,"x,y,z") | Attribute In | Person[] plist = Person:attributeIn(state, "Any, One, Of, These"); |
relationshipIn | Obj:relationshipIn(a,b) | Relationship In | Person[] plist = Person:relationshipIn(reportsTo, person); |
contains | Obj:contains(a,b) | Check is collection has element(s) | Person[] plist = Person:contains(name, "a"); |
beginsWith | Begin with | Person[] plist = Person:beginsWith(name, "a"); | |
endsWith | End with | ||
notEquals | Not Equals | ||
notEmpty | Not empty | ||
notBetween | Person[] plist = Person:endsWith(name, "a"); | ||
notEmpty | Not empty | Person[] plist = Person:notEmpty(mobileNum); | |
notBetween | Not between the data or elements | Person[] plist = Person:notBetween(dob, date1, date2); | |
notContains | Collection does not contain element(s) | Person[] plist = Person:notContains(name, "a"); | |
notBeginWith | Not begin with | Person[] plist = Person:notBeginWith(name, "a"); | |
notEndsWith | Check if value does not end with value being compared to | Person[] plist = Person:notEndsWith(name, "a"); | |
notAttributeIn | Attribute not in the given domain | Person[] plist = Person:notAttributeIn(state, "Any, One, Of, These"); | |
notRelationshipIn | Use to check for relationship | Person[] plist = Person:notRelationshipIn(reportsTo, person); | |
union | Union | Person[] plist = Person:union(equals(rating, "good"), equals(rating, "excellent")); | |
diff | Use to check for differences | Person[] plist = Person:diff(equals(), equals()); | |
intersect | Intersect | Person[] 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
Excerpt | ||
---|---|---|
| ||
all, equals, notEquals, etc. | select |