Assign numbers to sections

Hi,

I have 18 sections in a template I have developed. I want to assign a number to each section when it is activated ( with a thick) .
I am able to give a number to each section up to number 9 with the code bellow. After number 9 I am unable to continue with number 10, 11 … 18.

{% assign section = '1234567891012' %}
{% assign nr = 12 %}
 
{% ic %}{% input custom.tick.section_A as:boolean %}{% endic %}{% if custom.tick.section_A %}|{::font size="m"}**{{ section | slice:0 }}{% assign nr = nr | minus:1 %}{% assign section = section | slice:1,nr %})  Sales ledger**{:/font}| {% assign nr = nr | plus:1 %}{% else %}|{% ic %}{::font size="m"}  Sales ledger{:/font}{% endic %}{% endif %} 

Can you please let me know how can I fix this code in order to display numbers above 9 ?

Thank you,
Stefan

Hi @Stefan.Temelie,

Welcome to our community!

I would do it differently though, like his:

{% comment %}create separate var when boolean is ticked off{% endcomment %}
{% assign sections = "Sales ledger|Costs ledgers|Assets ledgers" | split:"|" %}
{% assign nbr = 0 %}

{% stripnewlines %}
  {% for item in sections %}  {% comment %}loop over all sections{% endcomment %}
    {% newline %}
    {% if custom[item].section == true %}
      {% assign nbr = nbr | plus:1 %} *{{ nbr }}* {% comment %}create var that counts as soon as a boolean is ticked off{% endcomment %}
    {% endif %}
    {% ic %}{% input custom[item].section as:boolean %}{% endic %} **{{ item }}**
  {% endfor %}
{% endstripnewlines %} 

Means some lesser code; we use the system of creating a var that adds one as soon as something is checked off, in our legal reports as well.

Is this something you can work on further?

Thank you for your reply.
I am pretty new at this. I will give it a try later.

No worries, we are here to help! :muscle: