Tinderbox Forum

Using Quickstamp on a series of notes: How to avoid overriding values already in the targeted attribute with QuickStamp?

I like to use Quickstamp on a series of notes but sometimes refrain because I am concerned about overriding values that are already in the targeted attribute.

For example: I have 5 notes selected and I want to add “ThisText” to the $Tags attribute. These notes already have values in their $Tag attribute. I do not want to overright the values, rather I only want to “append” the new value “ThisText”.

Is there a way to do this with QuickStamp? I know I can create an agent to do this but was hoping to do this within QuickStamp.
Thanks in Advance,

Tom

With lists—i.e. List and Set data types ($Tags is a Set) you need to add a value:

$Tags = $Tags + "some value";

Or in v9.1.0+, a shorter form:

$Tags += "some value";

But Quickstamp can only set the value of an attribute, i.e. the entire value. So it can’t be used with List/Sets/Dictionaries unless is is to set an initial value or to completely wipe/rest the existing value(s).

Side-note to self, I see description of Quickstamp really needs a health warning about use with multi-value data types as it has no syntax to add to, or remove from, existing list value(s). @eastgate, before I edit my docs—is this true, or am I missing some syntax?

In fairness, Quickstamp goes back to the dawn of Tinderbox, when things were much simpler. No List type then, just Sets which has a ~ toggle mode now no longer seen.

So, we need a stamp. But, how to avoid hard-coding the desired new values into the stamp? Use a note to hold the values and an offset reference. So, we add a note, for example ‘Tag stub’ and add MyString as a Displayed Attributes. Now add a Stamp:

$Tags += $MyString("Tag stub");

Now, to do your task, select note “Tag stub” and enter the new value. If more than one tags, simply place a semi-colon between discrete values. Now select the desired target notes and use the stamp.

You could also have a delete tag stamp counterpart:

$Tags -= $MyString("Tag stub");

Note, I’m deliberately not using $Tags in the “Tag stub”. Why? Firstly you don’t need to: you just need a string attribute value (that can also (semicolons!) be a list. Secondly, $Tags is something where you might want to collect all the used tag values (values()). In the latter case it would pick up any values you may have left set in the “Tag stub” note, potentially giving you a false positive in the list.

†. You can use a different name but adjust the stamp’s code. Do make sure the name is now that won’t be a duplicate.
‡. You could use a user attribute if you want—String or List type, it doesn’t’ matter. Don’t forget to alter the stamp’s code if you do.

Great history on Quickstamp. I did not know.
My takeaway here is that one needs to be be careful with Quickstamp not overwriting values in targeted note. If this is concern with selected notes, better use a stamp or create an agent.

With MichaelB use of dynamically created agents this may be the way to go here. I do not think you could create dynamically created stamps too to apply to a number of selected notes. Will not overthink here.

Tom

You can create a dynamic stamp, but not “quick stamps.” As explained, the quick stamp is for updating a value. Personally, I sue the quick stamp the most for resetting inheritance.