I found this old thread while looking up how to populate the suggested values of a list attribute. I want to add the example I’m working on, since it isn’t working for me yet (and I’m not sure what I’m missing).
I have:
- a note called /Roles that contains several notes, each being a job role that someone might be interested in taking on; the $Name of each is the job title
- a prototype called Learner, representing a person who’s learning technical subjects
- a list-valued field in Learner called RoleInterests, representing roles a particular person’s interested in taking on
I want the suggested values for RoleInterests to be populated with the names of the roles, i.e., the $Name of each child of /Roles.
From what I read here, I can get (for example) the $Text of Roles to contain the list of its child titles, no problem. Per this page, it seems I should be able to run an action like
attribute("RoleInterests")["suggested"] = "foo;bar;baz"
on Learner to set the suggested values, and that to draw these values from Roles I could write
attribute("RoleInterests")["suggested"] = collect(children($Roles), $Name).sort
in a Stamp applied to Learner. However, this doesn’t seem to have an effect—and for all I know, perhaps this isn’t the ideal way to be doing what I’m doing. So, could y’all point me in the right direction?
I’m using 9.1.0 (b542).
Thanks!