Tinderbox Forum

Attribute expression interpolation or dynamic attributes

I’m trying to do something like this x-devonthink-item://661CD8B2-2E20-46ED-8A40-243858672F38?search=$DisplayName

To clarify, are wanting to use the value of DisplayName (i.e. provided from $DisplayName) in a DEVONthink query URL? IOW, if a note’s display name is ‘Niklas Luhmann’ your example would become a usable URL x-devonthink-item://661CD8B2-2E20-46ED-8A40-243858672F38?search=Niklas%20Luhmann?

OK. let’s assume you’re store the final DEVONthink-ready URL in a user URL-type attribute DtURL. To make the above we use code:

$DtURL = "x-devonthink-item://661CD8B2-2E20-46ED-8A40-243858672F38?search="+urlEncode($DisplayName);

See more on urlEncode().

Does that help? If not, we might need a little more detail as to your process.

I’m brand new to TB.

My goal’s changed slightly, very similar, but that does help. I just need to know where to put the code for it to be evaluated? Currently, I have it in the top table part of the note pane, doesn’t evaluate.

Clearly the “x-devonthink-item://661CD8B2-2E20-46ED-8A40-243858672F38” part of the URL will change in each use, so from where are you getting this.

Don’t worry about the note’s Displayed Attributes table—as you’ve kindly shown above. First we need to figure is if you have the correct DEVONthink URL info with the x-devonthink-item info in Tinderbox. If you do, where are you storing it. If not, from where did you find the code in the original example

My understanding is the URL type you are using is a reference to a single DEVONthink item, the ‘?search=etc…’ suffix is searching only that DEVONthink item for the supplied search term.

The first part of the URL’s the DEVONthink item ID. The search param’s going to go to the first occurrence of the title, ie, annotation, within that item.

I said “changed slightly” because I might be able to get something more specific to the annotation, looking into this.

The immediate goal is to understand how to create attribute values from other attribute values with string interpolation.

OK, how do you intend to get that DEVONthink URL data and where will you store it in Tinderbox. That’s a precursor to the next step of making the desired search query.

On p. 209 of the DT manual, it states that the format for the URL command is:

x-devonthink://<command>?<parameter=value&parameter=value&...>

It gives an example:

x-devonthink://createRTF?title=New
%20bookmark&location=http%3A%2F
%2 Fwww.devontechnologies.com&noselector=1

So I wonder if it might be wise to look at the DT documentation.

My process was:

  • Create annotations in DEVONthink
  • Summarized highlights as sheet
  • Used Numbers to put annotation value first
  • Dragged into Tinderbox

This created all the notes, but the standard link back to DEVONthink is item ID with the page param. All my notes are single page PDFs, so not much use. Hence, searching for the annotation within the item.

I’ll then build on that initial solution.

I’ve manually tested the URL in my initial post, it works as expected.

I created another attr and then added a rule to update it.

I’d copy and paste the rule but I deleted it by accident and apparently undo doesn’t work :man_shrugging:

Oh, it’s bounced back somehow:

$New_link_url = $Link_url + "?search=" + urlEncode($DisplayName);
1 Like

Yes, your rule has got to where I was heading. I just didn’t know where you were getting/storing the first part of the URL. But, I’m assuming your attribute Link_url is holding that info so it all works now. If not, just ask. :slight_smile:

1 Like