Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Consider the following selectors, with the result of the first two used as parameters in the third:

Code Block
Facility[] fs1 = Facility:equals(active,”yes”);
Immrecord[] im2 = Immrecord:lessThan(lastvisitdate, Mez:today());
Children[] cs1 = and(
	relationshipIn(facility, fs1),
	relationshipIn(immrecord, im2)
);

We distinguish between complex and simple selectors as complex selectors consisting of multiple nested selectors. The following, therefor, is the complex selector version of the above snippet.

Code Block
Children[] cs1 = and(
	relationshipIn(facility, Facility:equals(Active,”yes”)),
	relationshipIn(immrecord, Immrecord:lessThan(lastvisitdate, Mez:today()))
);

This complex selector is more performant, potentially far more so. The reason is given in Lesson 10 of the Beginner's Tutorial, section "A Note on Complex Selectors":

Panel
borderColorsolid
bgColorcyan
Whenever possible, a single complex selector should always be preferred above multiple simple selectors. This is due to the fact that Helium will automatically optimise the backing data base queries for selectors. Using complex selectors instead of multiple simple intermediate selectors might therefore provide a significant performance advantage.

Another example can be seen at the above link.