Am I making up $AliasCount?

I thought there was a way to count the number of aliases a note has. Am I just completely making that up? I can’t find anything in the TBref.

No there isn’t. The easy way to check is to go to the System Attribute Inspector and type ‘Alias’ in the search box. Note the latter matches from string start and not on partial fragment.

find() always returns all originals and aliases in scope of the query. So if you do a find for a given (unique) $Name and file out the original the remaining list should be all the aliases. So (not tested) something like:

$MyAliasCount = find($Name=="Test note"&$IsAlias).count

Okay thanks for confirming. I was thinking something like find() could do the job. Typically I like to use $ID(original) to test for note identity.

I admit I made the common mistake of asking about a particular technique rather than what I’m trying to accomplish. I’ll open a thread for that.

How can I count the aliases of a note itself? I would like to show the number of aliases in the title of a note.

The answer is given above. If a doc-scope find returns 1 item, there are no aliases. Otherwise the alias count is the find().count minus 1 (i.e. removing the original). Important assumption: this works only if notes have unique $Name values. If you have two notes of the same and either/both has aliases this method can’t work.

If you want to use the count in a display expression, I strongly urge following the advice to use a rule/edict to find the alias count and store it in an attribute and then use the calculated value in your display expression. You don’t want all your notes constantly trying to run a find() across the whole of the document.

Does that help?

1 Like

If I am not mistaken $Aliases.size should work.

1 Like

$Aliases was first added in v8.0.0 (in April 2019).

FWIW. The aTbRef big listings of Attributes, Action and Export codes were added c.4.0. From v5.0 pre-existing items were marked as “already in v5.0.” and in v6+ as “Baseline”. This was a revised in v9 for that items added in the baseline version so that the version was shown, making pre-existing status clearer. Thus the v8 aTbRef shows $Aliases as ‘Baseline’ (true) though only being added in v9.0.0 (also true); thus you need to check v7 agains v8 baseline to confirm something added in v8.0.0 (something I’d overlooked.

When was a given Tinderbox released? This is listed under https://www.acrobatfaq.com/atbref95/index/Previous_Versions.html for pre-Baseline and in the Change Log for baseline and since. For the same reason as in the note above, the Change Log now includes the Baseline release.

Added the above in case it helps those searching old threads (this one started 5 years back)