Skip to main content
Inspiring
November 24, 2024
Question

Restart auto numbering when n=x

  • November 24, 2024
  • 1 reply
  • 715 views

Is it possible to have a context rule that resets the auto numbering after a certain value, e.g. if n=31, reset n=1. 

 

*Structured FM17

It can happen that several subsequent instances of the same Element uses the same number, e.g. 5. I use an Attribute (Counter) to specify whether the counter remains the same or is incremented. I don't now when the counter will reach 31, so I need to have it automatically restart at 1 if the next <n> value is 32.

 

*Edited to add additional information/context

    This topic has been closed for replies.

    1 reply

    Bob_Niland
    Community Expert
    Community Expert
    November 25, 2024

    In unstructured FM, this is typically done by having two different ¶formats available, perhaps named:
    Ordered[1]
    and
    Ordered[2+]

    Manually, the author would look for the first instance where the latter results in a display of:
    31. …content…
    then apply Ordered[2+], then look for the next instance of 31.

    Assuming a script has access to rendered content, it would be important to to this in order of document appearance, do the equivalent of an Apply, then start over, until no instances are found.

    Whether done manually or via script, any ordered content added or deleted later requires the whole process to be run all over again, or there is going to be disrupted list numbering. Whether that could also be automated isn't something I have a guess on.

    Inspiring
    November 25, 2024

    @Bob_Niland , I should have specified. This is Structured FM. Basically I have a Element that numbers the paragraphs from 1 onwards, but I need the numbering to restart at 1 once the counter <n> reaches 31, i.e. the next instance of the Element should start the numbering at 1 again. I might have to play around with Attributes to find a way to 'fundge' it - I'm not familiar with script and don't really want to delve into that at this point.

    Inspiring
    November 25, 2024

    Sorry, I meant you could use an if/else statement to restart the list via attributes. My arrow was in the wrong place--it should have pointed to the first line (and second to last line).

     


    That means I would need to create an attribute to manually reset the counter. As Attributes are not always visible in the Structure View, I've opted for a 'dummy' element that resets the counter to 1. It's not the ideal solution I was hoping for, as it still means I have to manually insert this 'dummy' element, and if any of the preceding numbering changes, I'd have to move this 'dummy' element to the correct place.