Hi, I’m a bit stuck - I have a TBX file where I have entities that should get a badge (in this case: a country flag) depending on what is written in the $Country variable. So if $Country = “gbr”, then the flag should be set as gbr.png.
(The appropriate flag is available in the “badges” directory of Tinderbox’s Application Support directory).
I thought that to accomplish this it would be sufficient to set an action that states
$Badge=^value($Country)^;
However, it does nothing. Where am I wrong? Help appreciated!
An action or OnAdd Action is performed by a container on children when they’re added to it. You want a rule, which a note performs on itself.
You don’t need to use ^value here. It’s fine just to say
$Badge=$Country
Finally, keep in mind that badge names are case-sensitive; if the badge name is “UK” and $Country is “uk”, it won’t do what you want.
Thanks! I seem to still be somewhat mystified as to the differences between actions and rules… Where can I bone up on that?
Rules are just one type of action: see more here and here (and in linked articles in those sections. as well as the Getting Started PDF tutorial found in the Help menu.
As has been noted, export code—i.e. with the ^caret^ markers—isn’t used in action code. At least not since c.v4, although you may find it in very old code samples from then the app was a lot simpler. At worst, it may not work but shouldn’t do any harm, so don’t worry.
Thank you - especially the second link is helpful.
I read the documents from the Help menu, but find that I need to repeat that from time to time as Tinderbox only reveals its secrets slowly to me… “Emerging structure” here as well!