Tinderbox Forum

Hacking a dynamic "suggested values" list

I have a prototype for Person which includes a field called $Employer. Each Employer has their own note (with a prototype of Organization) and is included in a container called Organizations.

The list of organizations is fairly stable, but when it grows, I tend to have a number of people to add as well: thus, I wanted to be able to change the suggested list for $Employer automatically.

Unfortunately, gathering the values of tag $Employer into a variable through:
$MyVar = values("Employer").isort
is not sufficient, as I have no way to programmatically populate the suggested values list with $MyVar

However, I came up with a roundabout hack: the Organization prototype has a rule:
$Employer = $Name
So whenever I create a new organization, the $Employer suggested list, being populated by all the existing values, is modified to reflect the new entity.

This really got triggered by the following phrase in aTBRef’s entry for suggested values :

This method replaces an older approach of making ‘seed’ notes a placeholders for desired prepared values.

Of course I may be missing a simpler way around this problem

This is neat. It took a moment to figure it out. In this case, the suggested values aren’t being touched but the overall list of used values for $Employer is being incremented by the new notes. However, as the notes doing this work are of (proto)type Organization and not Employer, then the it is still possible to filter out $Employer values only used by Employer notes (or Employee note, or whatever).

Edit: and the quote from aTbRef allowed me to spot and fix a typo. Extra win! :grin: