Attribute for Single Values?

Let’s say I have an attribute named “Fruit”. The set consists of “Apples, Bananas, Oranges, Pineapples.” in a dropdown list. At the moment, if I use a set, I can select the value of the attribute Fruit to be more than one value… i.e. I can select bananas, pineapples, and oranges. However, I want to only have one. i.e. Either one fruit / Or another fruit. Not one fruit “And” another… What attribute should I be using? Thanks.

Use the String attribute type, this way you will be able to chose only one item from the dropdown list.

I’d like the selection to be locked though. With a string, if I accidentally type something into the value, it will be added to the list of values, no? I don’t want that to happen. An example would be e.g. a list that says “Nationality”. And it’s got all the countries in the world. A person should only be able to select one, and not be able to type “Martian” for example. You see what I mean?

There’s not currently a way to lock one user attribute. (You can set a note to be ReadOnly, but that’s too drastic for this.)

One thing that would help is: create an agent that collects all notes where your attribute has a value other than the sanctioned values.

Query: !( ";German;Swiss;Freedonian...".contains($MyAttribute) )

Normally, the agent will find no notes; if it does find a note, you should correct it. Or, the agent could set $MyAttribute to a safe value whenever it finds a Martian.

Giving this issue some thought, my immediate suggestion of applying the Tagger may not address your objective. Could you advise the following:

  1. Interested to understand how exactly you are currently populating $Fruit Attribute - is it manually, or do you have pertinent information in $Text or in another Attribute?
  2. For situations where the “wrong” value - or multiple values - get entered in $Fruit, how does this occur? Is it due to manual entry, or are you already using Rule/Agent/Tagger to populate $Fruit?

I think there is scope for an Agent/Tagger solution of some kind, that could be tailored according to the process deployed. Interesting puzzle.

A noted, use a String attribute not a List or Set. Next, edit the attribute to add the allowed values as the attribute’s suggested values via the Inspector. Now, before you’ve added any values to a note, the Displayed Attributes (or Quickstamp, or Get Info/attributes table) value pop-up will show only allowed values.

From there only edit the attribute values by selecting a value from the pop-up list. That way you can only use an allowed value and being a string the any new value you add replaces the entire existing value.

But as humans, we are flawed, and struggle to follow our own processes. OK, so we forgot and manually edited a value and didn’t, as planned, use the pop up list. What then. You could make an agent, set $MyList to the above attribute’s suggested values and with a query that looks for any note with a value in the your String attribute and whose value is not in the agent’s stored list of approved values. Now the agent will list any note with a non-compliant value that you can then fix.

3 Likes