Action code in Attribute Browser

Hi. There is (it seems) an option to enter action code in the Attribute Browser. Adding something there, however, does not seem to have any consequences. Is this a bug, a feature or am I misunderstanding this field?

The aim of the query/action is as a form of agent within AB view. If you canā€™t slim down your list of in-scope notes via container, the query allows you to apply a query within the selected container (default contain is the whole doc).

The action is essentially like an agent action and should act on any matching note - i.e. any note in the current AB view.

You proposed action may not work, once it does, in the way you suspect as each time that action runs, it will add the same string to the end of $SloganName again, and again, and againā€¦etc. Unless you are filtering in the query for notes where $SloganName already ends with the desired suffix.

On the data given, I canā€™t say why the action isnā€™t working but Iā€™d suggest trying with a small test file and using basic roman alphabet values. The latter will help beat out if the issue is some odd Unicode issue.

Thanks again for the quick reply!

That is what I assumed.

The query includes a filter for that.

$Prototype=="*dokument-fragment" & $Text.icontains("ē¾Žäø½ę‘åŗ„") & !$SloganName.icontains("ē¾Žäø½ę‘åŗ„")

Thanks, will try this.

OK, that query makes sense and answers my concern about repeat actions. As you know the exact substring you want to match and where it will occur, you could use String.endsWith() rather than String.icontains() as I suspect the former is less regex/processor intensive. IOW the query term

!$SloganName.icontains("ē¾Žäø½ę‘åŗ„")

becomes

!$SloganName.endsWith("ē¾Žäø½ę‘åŗ„")

I tried my own small test and the action doesnā€™t seem to be executed. Might be a glitched. Iā€™ve never really used the AB action in real work before so I might be doing something wrong.

Thanks for the suggestion, I did not know about ā€œendsWithā€. Does it only work with string-variables?

In regard to the main question (action code not working in the AB) I might have to mail @eastgate.

Here is a list of available actions and associated data types. Note the .endsWith() operator works on strings but many other attribute types are essentially strings, e.g. List or Set.

Iā€™ve already raised the possibility of there being a glitch with AB view actions but it might also be useful to contact support yourself if you already have a tst case TBX that properly exposes the issue (and which you could let support see).

For various reasons ā€“ possibly not good reasons, but not absurd ā€“ the Attribute Browser action is only applied to new notes created in the attribute browser view.

How does one create a new note in the attribute browser view? In attribute browser view, all the relevant commands in the Note and File menus are greyed out; and the one that isnā€™t greyed out (Explode) doesnā€™t work.

Changing this would be huge improvement for my workflow (I would need agents way less often) and it seems that almost nobody else cares. :wink:

???

There has always been significant appreciation of the attribute browser, for the reason you mention and others.

Sorry for the confusion. What I wanted to refer to was that apparently nobody took issue with the lack of functioning of action code in the AB in recent times. :smirk:

1 Like

Agree 100% with @PaulWalters .

Easy way to test the ā€œno one cares about the attribute browserā€ hypothesis: read one of the many extensive threads on how to use it and why it matters. Eg the one starting here:

Also

And

I was only talking/thinking about this:

I know that many love the AB (your posts on the topic have been an inspiration for me). Again, sorry for not being clearer on this.

For what it is worth, when I first started using Tinderbox, I thought the Attribute Browser was pretty powerful. However, I had a guess that the Action should do something like an agentā€™s action, but it never worked as I expected. So I assumed I was misunderstanding something and that I might find out later when I needed to. In other words, youā€™ve asked the question I should have asked. And, like you, Iā€™d find it helpful if it worked as you and I seem to have expected.

1 Like

Ah, understand, thanks.

In the sense of your original comment, it actually is true that I, personally, ā€œdonā€™t careā€ about having this kind of query/action functionality within the Attribute Browser.

I use the query part of the AB very intensively ā€“ working it almost to death! The AB is my go-to working palette when Iā€™m organizing notes for an article or book, when Iā€™m trying to sort out the status of various to-doā€™s or projects, when Iā€™m categorizing financial data, etc.

But toward those ends I use the queries strictly to regulate and refine the display of what Iā€™m seeing in the different sections of the AB view.

When I want to do something with them, 99% of the time I use the Column feature, and either (a) have a check-box, to switch something from ā€œUndoneā€ to ā€œDoneā€ etc, or (b) add a new string or set value to one of those attributes.

I very frequently want to change note values via checkbox or column-value. But I, personally, donā€™t ever want or need to make those changes on the basis of a query/action operations. (If and when I want to make changes via an agent or query, I go back to an outline view.)

I understand that other peopleā€™s work habits differ. This is why I didnā€™t register what you were asking about ā€“ itā€™s a use case that never comes up for me.

Off-topic: I do the same but struggle with one aspect of this. I use Scrivener to write and would like to retain a link to the note in the text so that I later can verify the quote. In the past I used ā€œTinderbox > Copy Note URLā€ and handmade UUIDs for this purpose, without being really happy with either solution. What do you use for linking a note in TBX to Scrivener/your word processor?

Maybe some more info on my use case is helpful. Iā€™m looking at a policy called ä¹”ę‘ęŒÆå…“ or Rural Rejuvenation, which is part of Xiā€™s Rejuvenation of the Chinese Nation. I noticed that in the key documents of this policy the term beautiful (ē¾Žäø½) is a new addition and now want to track all variants of its use in the variable $SloganName (of the type ā€˜setā€™).

The Attribute Browser is great to find all of these cases. I could then add terms like ē¾Žäø½ä¹”ꝑ individually to all notes that carry it (or use an agent to do that for me) - but it would be great if I could automate it right in the Attribute Browser.

1 Like

Hereā€™s another possible solution: via Stamp or QuickStamp, which (in my experience) work fine within the Attribute Browser, and give you the agent/action power you are looking for.

Main functional differences between them, to best of my knowledge: (a) Stamps can be saved, so if there is an action youā€™ll want to perform frequently, you can set up it as a go-to stored stamp. QuickStamps, by contrast, are ad hoc and not saved. (b) Stamps can have full action code, and can do pretty much anything an agent can do. (If they donā€™t, I havenā€™t myself encountered the limit yet.) QuickStamps, by contrast, change the value of an attribute, but donā€™t deploy the whole action-code vocabulary. More info here.

Both Stamps and Quickstamps can apply to a single item, or to a range of selected items. What Iā€™d do, in your use case:

  • Select the item(s) you care about, while youā€™re working in Attribute Browser
  • Call up the Stamp/Quickstamp menu, and either do an ad hoc change via Quickstamp, or apply a saved Stamp.
  • I think that the saved stamp could say something like $Tags=$Tags+"ē¾Žäø½ä¹”ꝑ" (or whatever attribute youā€™re wanting to change). Expects will correct me, but I believe a formulation of that sort would add an additional value to a set-type attribute.

儽čæ ! [For onlookers: Good luck]

Update Thanks for clarification by @mwra, below, that the AB does not allow multi-item selection. But itā€™s quick and easy to apply stamps to them one by one.

2 Likes

A further useful point about stamps. When applied, the stampā€™s code once on the selected note(s) (AB view actually doesnā€™t allow multiple selections).

The point here is you have very tight control of what happens to which notes.

Bear in mind the AB view doesnā€™t always refresh as often as other views. Some changes update the view, e.g. changes to attribute values tested by a query. This might seem an annoyance but in big/mature document it is actually a boon as itā€™s not always helpful if the view is trying to re-draw just as you are trying to read it. That said you can force a manual refresh by clicking on the current viewā€™s tab; in fact i believe this method works for most (all?) view types.

Are there any plans to allow multiple selections in AB? That limitation is a pain.

Iā€™m not aware of plans. Iā€™d assumed the status quo is in part dictated by the underlying design. Still, no harm in making a feature request with a use case.