After all the above I forgot the other issue. How to fix a typo in a list. I’cve just done this very thing. Editing aTbRef for v9, I noticed my $OPType value pop-up in Displayed Attributes showed a “Data Manipulation” and a “Date manipulation” value, the latter being wrong. If I knew there was only one note with the wrong value, I’d just edit the Displayed Attributes by either:
- Click into the desired attribute’s value box and edit the new value.
- Click the desired attributes value pop-up listing and click the bad value, this un-tick/removes it from this note. Now click the correct value if listed in the pop-up or manually add the new value - remember to put a semicolon after the existing last item before typing.
- Note the bad value may still show in the pop-up until you select a new now and the value list is refreshed.
More likely, and as in my case, I knew there were several notes amongst possibly >100 with the wrong value. An agent is the way to go. Make an agent. In my case the attribute was a String-type attribute
OpType. So the query is:
And we add an action setting the correct value:
note the use of a ==
equality test in the query vs. the
= assignment operator in the action.
The agent will briefly detect and make alaises for the notes with bad values. this updates their $OpType value, causing them to cease to match the query. Once the agent is empty again, the job is done and you can delete the query, or address another discrete spelling issue in the same or another attribute, amending query and action accordingly.
But, what is this were a multi-value (Set or List) attribute, such as $Tags. Let’s do the same exercise for that. We can use
== with a multi-value attribute but so we use
.contains() to match whole values (regex are not supported in this context). As the error is a typo, we want a case-sensitive match. So the agent query is:
That finds notes with the bad value. Now, we need to remove the bad value and add the correct one. But as the removal affects the query, I always add first and subtract second. It’s all in one action and it shouldn’t matter; but, belt & braces! So, the action is:
$Tags = $Tags + "Data Manipulation";
$Tags = $Tags - "Data manipulation";
As in the earlier case, the agent will run, find the ‘bad’ items, correct their values and the agent will empty as all the errors are fixed.