Candidate Tag Expression

From HLKitWiki
Jump to: navigation, search

Context: HL KitKit Reference … Tag Expression Types 

The role of the Candidate tag expression is to determine whether a pick or thing should be included in a choose form. The choose form contains the list of picks/things from which the user can select when adding items to a portal (i.e. dynamic table, chooser, or thing-based menu). If the tag expression is satisfied, then the pick/thing is shown within the list of options and can be added by the user. Otherwise, the pick/thing is omitted from the available list.

The Candidate tag expression is always applied against the pick/thing itself. The tag expression is compared against all of the tags possessed by the object. For picks, this includes the effects of all dynamically assigned and deleted tags. The Candidate tag expression is only invoked when the user triggers the portal to display the list of options to choose from. Consequently, the tags used for picks are the final set of tags after evaluation completes. This also means that picks can dynamically change their state and change whether they appear as valid choices within a given portal.

When a Candidate tag expression is used in conjunction with a List tag expression in a dynamic table, special behaviors can be leveraged. If you omit the Candidate tag expression entirely, the List tag expression is implicitly assumed, resulting in the user being able to select the same set of items that will be displayed. If you specify both tag expressions, the Candidate tag expression will normally supersede the List tag expression. However, if you specify the "inheritlist" attribute as "yes" on the Candidate tag expression, then the two tag expressions will be considered additive. Objects included in the selection list must then satisfy both the Candidate tag expression and the List tag expression. This allows you to avoid redundantly defining the logic of the List tag expression in both places while also ensuring that the items shown for selection correspond to the items that are intended to be shown in the table.