Tinderbox Forum

Code to display attribute content in note body

Dear Forum-Gang,

when playing around with a new project file I seem to not be able to access all attribute content through search. When importing bookends refs the prototype has an attribute “abstract”. However, when using the search function it appears as if the content of that attribute is not included in the search as the note never gets reported as a match. For that and for other reasons I was hoping to be able to adapt the prototype to display / copy the content of the “abstract” attribute in the note body.

is that possible?

thanks for taking the time, stay safe,

J.

Trying to replicate. I’ve Cmd+Opt+dragged a refence from Bookends to Tinderbox and it has imported. The reference’s Abstract is in attribute Abstract as see here:

Could you please report how you are searching, the code if any used and the part of the abstract you are expecting to match. Note, most methods are case-sensitive by default. IOW, a search for ‘Mickey Mouse’ using $Abstract.contains("mickey Mouse") would fail. But if a case-insensitive search is used $Abstract.icontains("mickey Mouse") a match would occur.

If you want the built-in “Reference” prototype (i.e. as illustrated above) to overwrite the default $Text of the reference’s source RIS data, add this as an Edict or Rule:

$Text = $Abstract;

Ta da!

Hi Mark,

thanks for the swift reply. Interestingly, your first image displays content in the text-field of the note. For me this does not happen at all.

My Abstract attribute is populated like yours but maybe I searched wrong. Case sensitivity has been neglected but I also tried command+F instead of search syntax through agents… that might be another problem. Regardless, for certain parts of my workflow the text field is easier to access and make use of. Can I combine the $Text = $Abstract in a way with the bookends citation-ID? Here first of all, this ID would need to be transferred when dragging the reference into TB9, as it does not seem to be listed in the attributes… (I do not mean the bookends-URL, that is carried over)

Thanks for taking the time,

Johannes

Hmm. For my demo I opened Tinderbox and Bookends. I made a new TBX file, and arranged windows so both Bookends and the TBX were visible. In Bookends I selected a reference (at random in my case) in the main listing.

Then, pressing Cmd+Opt ( ⌘+⌥) before clicking on the selected time, I clicked on the Bookends item, dragged it over and dropped it onto the TBX window view pane.

On drop, if the built-in References prototype is not already in the TBX (as the case in my demo), Tinderbox adds that prototype to the TBX document and applies it to the new drop-created note.

I’m using Tinderbox v9.0.0b523 on macOS 10.14.6 (still waiting for multiscreen-capable M1 MacBook Pros to arrive :roll_eyes: ) At the Bookends end I’m on v14.0.1.

Tinderbox first started pulling the reference’s abstract in $Text in v7.2.0 (see here) before changing in v7.2.2 to putting the abstract in $Abstract (which got added for this purpose).

Whether $Text of the new reference note contains a format-specific formatted reference string depends on the current export format selected in Bookends. The code seen in the $Text area above is RIS BibTeX as that was my default Bookends format at the time; actually, the ‘code’ is the ‘formatted’ citation string as that is what BibTeX looks like! If I were change the Bookends export format to ACM, for instance, I would get a formatted reference string like so:

I’ve updated my page on Bookends in aTbRef (here) to reflect this nuance as to what ends up in $Text [Edit: aTbRef page now further corrected to reflect later correctiosn here!]. I’d agree it’s unguessable and hard to track down in the apps’ documentation.

† Why it matters I don’t know, but you must depress the Cmd+Opt before starting the click-drag or the process doesn’t work. This is a limitation/requirement of Bookends.

In short, No! You get either the formatted string, or the RIS data , as described in my last post.

I think the only way to see the full abstract is to post it as the $Text of either the reference note or into a completely new note.

Thanks for the pointers. Will give the code a shot. silly question, maybe, but where do I put the action code?

The reference dragging is performed as you described. With one and multiple notes the result is the same. So will have to resort to the code.

btw, is the citation ID (the one you put into manuscripts, not the URL) handed off by bookends to TB?

all the best,

J.

How Tinderbox interprets the data on the drag is an internal function within Tinderbox, so behind the curtain and beyond the reach of the user.

Where to put code? There are several places.

In a prototype action. You could set (or add to code) in the ‘References’ prototype’s Edict. It would then fire on first use or whenever all edicts fire (e.g. on manual agent update). Of course you now have the abstract stored twice for each note so toy could remove the ‘duplicate’ like so:

$Text = $Abstract; $Abstract=;

But what if you want to retain the original $Text (i.e. the formatted citation string)? This doesn’t work as a rule or edict:

$Text = $Text + $Abstract;

I can only assume the edict code runs before the default $Text is generated, i.e. the result is only the abstract. Anyway, you only want to do this once, therefore personally I would use a stamp that I’d apply after the reference note was created. For instance:

$Text = $Text + $Abstract; $Abstract

or perhaps a second one for where RIS data ends up as $Text. The RIS is already (in v9+) in $RISDictionary) so we don’t need it in text. Indeed, it’s only there if the drag payload has no formatted citation string. So we might have a second stamp:

$Text = $Abstract; $Abstract

FWIW, with either method you still have a a further two back-up copies of the abstract as it i in $ReferenceRIS and more addressably in $ReferenceDictionary (a string accessed via $ReferenceDictionary["AB"]; as the key names are the RIS field labels: ‘AB’ for Abstract, etc.).

By the way, I misspoke above re reference $text & RIS—what you saw is BibTeX not RIS data as BibTeX was the Bookends selected export format when I was tested. My error, and corrected above to assist later readers.