Tinderbox Forum

How do I display an attribute in text?

I routinely create implementation guides for clients and want to streamline the process using Tinderbox. I would like to take a key attribute $Organization and display that in my text. An example:

We recommend that $Organization archive programs quarterly.
becomes on export:
We recommend that Foundation Partners archive programs quarterly.

How do I do this?

Funny, I’ve been using TB for years, but always feel I’m just beginning…

We recommend that ^value($Organization) archive programs quarterly.

Brilliant, thank you Mark.
@eastgate

Noting your comments in various threads that you’re returning to export, you might find of use the listing at aTbRef of Export codes. Older deprecated codes are now weeded from that listing. If you have templates using such older codes, you are encouraged to update them.

I don’t. Basically, I was using a couple of big TB docs for years at one job, and now I’ve moved on. I’m starting fresh with a new focus, so I’m a bit rusty at some of the more interesting things Tinderbox can do. I have to say, it’s quite fun getting back into it!

Hi, I am also trying to display an attribute value in the $Text of a note, for example $Name of the note. I have tried the recommended code

^value($Name)

as well as

^value($Name)^

but it does not display the value of $Name in the $Text of the note. Is there something else that I need to do?

Thanks for your help. I am relatively new to writing action code in Tinderbox.

^value()^ is export code. Which means, what you put in the $Text of a note, if it includes export code, the calculated result of that export will not be show in the Text pane – but it will show in the Preview Tab, if that note has an export template assigned to it.

Here’s a sample Tinderbox file that demonstrates the concepts.

Open the document, then make sure Window > Show Text Pane Selector is active. With the “Test Note” selected, click “Preview” to see the result of including ^value($Name)^ in the text of a note when exported or previewed.

Include values in export text.tbx (79.0 KB)

Thanks Paul for clarifying that the attribute value only appears in the Preview panel. It is working just as you suggest it should until I add the built-in Scrivener Template. Immediately after adding the built-in Scrivener Template, the value of the $Name attribute displays in the Preview panel as a “0” [zero]. This does not happen after adding the built-in template for opml or html. It only happens after the Scrivener template is added. If I drag the Scrivener template out of the template container, then it resumes working (it once again displays the correct value for the $Name attribute). Is this a bug ? Or is something happening that I simply do not understand about the use of templates in general or the Scrivener template in particular? I am not applying the Scrivener template to any note. The problem occurs just from adding the Scrivener template to the template container.
See the attached example Tinderbox note. Example Tinderbox Notes.tbx (94.6 KB)
Thanks for any help in understanding this behavior.

Gregory

The reason your test fails is you have added a template to your document that lacks the code explained in @PaulWalters’s example above. If you copy the template named ‘textExportTemplate’ in his example into you document’s ‘Templates’ container and set your text note to use that template, and the experiment works.

The fact you added a template for (OPML) export for Scrivener implies you are trying to do more than just display a note’s title in the text. For instance, in the app, the selected note’s title is shown in the top of the text pane, so there’s no real gain in adding it to the note’s ^Text^. Plus if you want to see an attribute value, why not add that attribute to the Key Attributes table for the note?

If this is part of a larger task, telling us a bit about it might help us get you to the best way forward.