Adaptting "Jaarverslag" - If / if / Else

Hi there,

I’ve start to adapt the “Jaarverslag” by adding some code.
I want to ask my users to choose if between 2 choses, if not chosen one of them, it needs to give the same tekst.
After trial and Error, I came to this code :
—>{% assign nr = nr | plus:1%}{{nr}}. Rekening-courant
{% inputcomment %}
Indien er geen Rekening-courant aanwezig is, niets aanvinken, anders selecteer één of meerdere van onderstaande :
{% input custom.artikels.debit_zijde as boolean %} Debit zijde
{% input custom.artikels.credit_zijde as boolean %} Credit zijde

{% endinputcomment %}

{% capture rc %}

{% if custom.artikels.debit_zijde == ‘true’ %}{% assign debet_rc = true %} {% endif %}
{% if custom.artikels.credit_zijde == ‘true’ %}{% assign credut_rc = true %} {% endif %}
{% endcapture %}

{% if debet_rc %}
|:—5%—|----50%------|----10%------:|-----10%----:|—25%—|:
| |Naam | bedrag | aangerekend percentage|{% fori debit in custom.debitrc %}
| |{% input debit.Naam %}|{% input debit.bedrag as:currency %}|{% input debit.percentage as:percentage %}| |{% endfori %}`

{{ geen rc }}
{% else %}
ga hier naar geen rc?
{% endif %}

{% if credit_rc %}
|:—5%—|----50%------|----10%------:|-----10%----:|—25%—|:
| |Naam | bedrag | aangerekend percentage|{% fori credut in custom.creditrc %}
| |{% input credit.Naam %}|{% input credit.bedrag as:currency %}|{% input credit.percentage as:percentage %}| |{% endfori %}`

{{ geen rc }}
{% else %}
{% case director_type %}{% when ‘zaakvoerder’ %}De zaakvoerder bevestigd{% when ‘zaakvoerders’ %}Het college van zaakvoerders bevestigen{% else %}De raad van bestuur bevestigen{% endcase %} dat er geen saldo’s op de debit of creditzijde van de {% if company_form == “COMMV” %}interne jaarrekening{% else %}jaarrekening{% endif %} aanwezig zijn.
{% endif %}<—

Ho do I get the first ‘If’ to goto Geen Rc

Greets
Sven

Hello @Sven.G,

First, there’s no really need to capture rc. This code is enough :

{% if custom.artikels.debit_zijde == 'true' %}{% assign debet_rc = true %} {% endif %}
{% if custom.artikels.credit_zijde == 'true' %}{% assign credit_rc = true %} {% endif %}

Also, you wrote down credut_rc when later in the code you use credit_rc.

This code will display the first code if the if-statement is fulfilled (when it’s checked that is). If it’s not check, then the else-statement will be fullfilled.

Also, you give {{ geen rc }} but nowhere that variable is being defined (so it really doesn’t exists).

Does this help you forward?

Hi @sven

Thank You.
First Question, why no capture . I copied the code from the “risico’s” so therefore I used it to.

Second, the {{ geen rc }} it True. so I can make a custum.artikels from it so I can refer to it our do you think of an other Approach.

Thanks in advance.
Sven

I don’t see any where the {{ geen rc }} is created. And it shouldn’t work because there’s a space between.

So at least it should be geen_rc for instance.

The capture-thing is not necessary because you don’t use the whole code between {% capture %} and {% endcapture %}; you just use the ‘true’-value of it.

Maybe you can post some screenshots because I’m not entirely following what you are trying to do.
You want users to check option A or B, and if nothing is selected that it displays a whole other text, no @Sven.G ?

Hi @sven,

Indeed. You can choose A) Debit B) Credit. If none is chosen, you get the geen_rc

Hello @Sven.G,

Then this code would do :

{% input custom.some.things as:select options:'debet|credit' %}

{% if custom.some.things == 'debet' or custom.some.things == 'credit' %}
something has been selected 
{% else %}
nothing has been selected 
{% endif %}

Could you try with this? Let me know if you’re stuck.

Hi @sven,

This is my code now, but gives me not the solution.
The select options is a great one, but we have somethimes both. thats why i was using a boolean.

{% input custom.some.things as:{% input custom.artikels.debit_zijde as boolean  %} *Debit zijde*<br>{% input custom.artikels.credit_zijde as boolean  %} *Credit zijde* 

{% if custom.artikels.debit_zijde == ‘true’ %}{% assign debet_rc = true %} {% endif %}
{% if custom.artikels.credit_zijde == ‘true’ %}{% assign credit_rc = true %} {% endif %}

{% if custom.some.things == custom.artikels.debit_zijde == ‘true’ or custom.artikels.credit_zijde == ‘true’ %}
{% if debet_rc %}
|:—5%—|----50%------|----10%------:|-----10%----:|—25%—|:
| |Naam | bedrag | aangerekend percentage|{% fori debit in custom.debitrc %}
| |{% input debit.Naam %}|{% input debit.bedrag as:currency %}|{% input debit.percentage as:percentage %}| |{% endfori %}`
{% endif %}

    {% if credit_rc %}
    |:---5%---|----50%------|----10%------:|-----10%----:|---25%---|:
    | |**Naam** | bedrag | aangerekend percentage|{% fori credit in custom.creditrc %}
    | |{% input credit.Naam %}|{% input credit.bedrag as:currency %}|{% input credit.percentage as:percentage %}|  |{% endfori %}`
    {% endif %} 

{% else %}
{% case director_type %}{% when ‘zaakvoerder’ %}De zaakvoerder bevestigd{% when ‘zaakvoerders’ %}Het college van zaakvoerders bevestigen{% else %}De raad van bestuur bevestigen{% endcase %} dat er geen saldo’s op de debit of creditzijde van de {% if company_form == “COMMV” %}interne jaarrekening{% else %}jaarrekening{% endif %} aanwezig zijn.
{% endif %}

I’ve updated your code just a little bit @Sven.G :

{% if custom.artikels.debit_zijde == 'true' %}{% assign debet_rc = true %} {% endif %}
{% if custom.artikels.credit_zijde == 'true' %}{% assign credit_rc = true %} {% endif %}


{% input custom.artikels.debit_zijde as boolean  %} *Debit zijde*<br>{% input custom.artikels.credit_zijde as boolean  %} *Credit zijde*


{% if debet_rc %}
|:---5%---|----50%------|----10%------:|-----10%----:|---25%---|:
| |Naam | bedrag | aangerekend percentage|{% fori debit in custom.debitrc %}
| |{% input debit.Naam %}|{% input debit.bedrag as:currency %}|{% input debit.percentage as:percentage %}| |{% endfori %}`
{% endif %}

{% if credit_rc %}
|:---5%---|----50%------|----10%------:|-----10%----:|---25%---|:
| |**Naam** | bedrag | aangerekend percentage|{% fori credit in custom.creditrc %}
| |{% input credit.Naam %}|{% input credit.bedrag as:currency %}|{% input credit.percentage as:percentage %}|  |{% endfori %}`
{% endif %}

{% unless debet_rc or credit_rc %}

{% case director_type %}{% when 'zaakvoerder' %}De zaakvoerder bevestigd{% when 'zaakvoerders' %}Het college van zaakvoerders bevestigen{% else %}De raad van bestuur bevestigen{% endcase %} dat er geen saldo's op de debit of creditzijde van de {% if company_form == "COMMV" %}interne jaarrekening{% else %}jaarrekening{% endif %} aanwezig zijn.

{% endunless %}

I think this generates the behaviour you want.

If you don’t understand, let me know but I think the code is much easier this way.

Hi @sven,

The Unless is new to me, but I understand what is does.

Thank you for your help.

Sven

Hi @sven,

How can I reopen this question?