use an autonumber reference in another location

+1 vote
asked Aug 1 in Wanted features by yoni
In a sequence diagram, when autonumber is used, I want to be able to reference to a previous item according to its assigned number. I am aware of the %autonumber% variable, but it is applicable only for the current item I would like to do something like setting a variable to the numbered value of an item, and later use this variable on a text of arrow or note.
commented Aug 17 by Martin

It's always worth offering some syntax when suggesting a new feature.  E.g. the following Q looks similar, and suggests using a # notation to set named points:

I tried to use the preprocessor to mess with %autonumber%; but (as its name should have told me), it runs before the diagram is drawn, and so %autonumber% is undefined.  But perhaps some new syntax like:  %autonumber -2% to get the value from 2 steps previous (nb this would be a simple calculation except that autonumbering can be resumed with a different increment/format).  And/or 'autonumber name=myname' plus '%autonumber myname%'.

1 Answer

0 votes
answered Aug 18 by Yoni
Thanks for the answer. For my needs, the "%autonumber -2" alone is not good enough since I often change the ordering of the sequence over time, add steps in between etc. So as suggested in the other thread, the "#notation" will be a great solution. Also the following which is what I had initially in mind -

autonumber "<font color=blue><b>0 "
A->B: message
var %first-message% = %autonumber%  /`This should take the value of the last number that has been used by the autonumber functionality`/
B->A: This is the response to message %first-message%

note over A: This is a note that references message %first-message%