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?