Dirk
(Dirk Kalmbach)
April 12, 2019, 3:18am
1
I can’t find the correct code for $OnAdd to add additional $KeyAttributes for all notes within a container:
$KeyAttributes=$KeyAttributes+“Learning;Known;NotKnow”
overwrites all existing KeyAttributes. How can I add KeyAttributes?
*(Learning
, Known
and NotKnow
are already defined user-attributes.)
ralvy
(Ralph Alvy)
April 12, 2019, 4:05am
2
What about this:
$KeyAttributes=($KeyAttributes+“Learning;Known;NotKnown”);
And if that fails, I’m not sure if TB allows for Smart Quotes there. I also assume you meant ‘NotKnown’ not ‘NotKnow’. Perhaps that’s why it failed.
Dirk
(Dirk Kalmbach)
April 12, 2019, 4:15am
3
Yes, this works. I missed the parentheses. Thanks, Ralph!
2 Likes
mwra
(Mark Anderson)
April 12, 2019, 7:49am
4
Assuming the curly quotes are due to forum re-formatting of text, when I test:
$KeyAttributes=$KeyAttributes+"Learning;Known;NotKnown"
I get 3 new attributes in the notes KAs. So I wonder if there is some other factor at play in @Dirk ’s document.
In action code, adding a string of semi-colon delimited terms to a Set or List type attribute will cause the string to be parsed into items and each of those will be added as a new list item. See more .
eastgate
(eastgate)
April 12, 2019, 3:05pm
5
$KeyAttributes=$KeyAttributes+“Learning;Known;NotKnow”
This does work, too. Of course, the quotation marks must be straight quotes.
ralvy
(Ralph Alvy)
April 12, 2019, 3:54pm
6
Could it be because his original code misspelled ‘NotKnown’ and there was no User Attribute $NotKnow?
mwra
(Mark Anderson)
April 12, 2019, 4:06pm
7
I doubt it. I added a $Learning attribute and note the other two, then used the code to stamp a note with an existing KA. The result:
The greyed out items in the KAs are attribute names defined in the notes $KeyAttributes list values but which don’t match an existing attribute.
Dirk
(Dirk Kalmbach)
April 13, 2019, 4:54am
8
I tried $KeyAttributes=$KeyAttributes+"Learning;Known;NotKnown"
again and it works now. Probably I really used incidentally curly braces (wasn’t aware of this).
So thanks again, everybody.
Really appreciate your efforts!
2 Likes