Is there a way to add multiple values to the $DisplayedAttributes so that the previous values are not overwritten or deleted?
Most certainly. It will ultimately depend on what you’re doing, but it sounds like you’ll want to use an attribute with Type List (i.e., list of items that include duplicates), Set (lists of items that do not include duplicates), or Dictionary (list of key pairs). You can use action code to automatically add and remove items from lists, sets, and dictionaries.
If you can specifically explain what you’re trying to do I can mock up a demo for you.
$DisplayedAttributes is a list, which Tinderbox represents like this:
You can edit this list much like any other Tinderbox attribute. Or, if you want, an action such as an agent action or a stamp might do this for you.
Thank you @satikusala and @eastgate for your feedback.
I’ll try to explain what I meant.
Let’s see we have $DisplayedAttributes for Note1 and Note2.
The $DisplayedAttributes of the Note 1 doesn’t equal the $DisplayedAttributes of the Note 2.
I would like to add 2 same values to both $DA Note 1 and $DA Note 2.
So we had $DA(Note1)= X;Y.
We’re going to add P and Q so we’ll have
I tried to create a stamp but I’m confused about the syntax.
Could you please advise me how should I write the code?
Sorry, I misread your question in the first place. Question, is there a reason why you’re not using $Prototypes to keep the displayed attributes of these notes in sync?
Michael, my fault I didn’t start using Prototypes at early stages.
Now my database consists of approx 5-6 types of notes with different attributes (and consequently different $DisplayedAttributes). What I want is to add 2 similar attributes to all of them (while saving attributes that already defined).
I see, but I think this too could be fixed with promototyps. If you’re interested, DM me and we can hop on a zoom call. I think I could help you work out what you want to do quite quickly, wither with a new prototype strategy or helping ou with a stamp.
This is not too hard to do.
We can add lists together to append them. So, if we want to add the attributes of some other note to whatever this note displays, we’d say:
$DisplayedAttributes = DisplayedAttributes + $DisplayedAttributes(/that/other/note)
Now, that would include two entries for each attribute that BOTH notes currently display. For a few notes, you could simply delete the duplicates by hand. But it’s easy enough to get rid of the duplicates, because a set is just a list that ignores duplicates. So, we can say
$MySet = DisplayedAttributes + $DisplayedAttributes(/that/other/note); $DisplayedAttributes=$MySet;
Thank you, Michael. Unfortunately, I saw your message too late.
Thank you so much, Mr Bernstein!
I’ve create a stamp with that
code and it works perfectly!