Liquid error: undefined method []' for true

Hi, i get the liquid error “Liquid error: undefined method []’ for true:TrueClass|Liquid error: undefined method []’ for true:TrueClass” inside a table and I don’t know where this came from. Anyone an idea?

|Uitleg       | Bedrag {% newline %}
|-------------|---15%------:+{% newline %}{% fori uv in custom.voorz_tabel %}
|{% input uv.text as:text size:mini %}|{% input uv.value as:currency %}{% newline %}{% endfori %}
{% endstripnewlines %}````

Hi Peter,

Could you please share the rest of the code? I don’t see any issues on that section.

Best,
Borja


<!-- Translations -->

{% t= "Overzicht van de voorzieningen" fr:"Aperçu des provisions" %}
{% t= "Andere" fr:"Autres" %}
{% t= "Voorzieningen voor risico's en kosten" fr:"Provision pour risques et charges" en:"Provisions for risks and charges" %}

<!-- LOCALE -->
{% assign locales_string = "nl|fr|en" %}
{% assign locales = locales_string | split:"|" %}
{% capture forced_locale %}{% if company.custom.select.language == blank %}{{ locale }}{% else %}{{ company.custom.select.language }}{% endif %}{% endcapture %}

{% ic %}

|--------------------:+
|{% input company.custom.select.language as:select options:locales_string %}{% endic %}

<!-- END LOCALE -->

{% locale forced_locale %}

<!-- deel ACC -->

# Accountancy

<!-- VOORZIENINGEN -->
{% input custom.voorz_tabel.show as:boolean %} **{% t "Overzicht van de voorzieningen" %}**

{% capture input_voorz_tabel_nl %}

{% stripnewlines %}
|Uitleg       | Bedrag {% newline %}
|-------------|---15%------:+{% newline %}{% fori uv in custom.voorz_tabel %}
|{% input uv.text as:text size:mini %}|{% input uv.value as:currency %}{% newline %}{% endfori %}
{% endstripnewlines %}

{% endcapture %}


{% capture input_voorz_tabel_fr %}

|Explication  | Montant
|-------------|---15%------:+{% fori uv in custom.voorz_tabel %}
|{% input uv.text as:text size:mini %}|{% input uv.value as:currency %}{% endfori %}

{% endcapture %}

{% assign voorz_tabel_var = "input_voorz_tabel_" | append:company.custom.select.language %}

{{ [voorz_tabel_var] }}

{% capture voorz_tabel_nl %}

|Uitleg       | Bedrag
|-------------|---15%------:+{% for uv in custom.voorz_tabel %}
|{{ uv.text }}|{{ uv.value | currency }}{% endfor %}

{% endcapture %}

{% capture voorz_tabel_fr %}

|Explication  | Montant
|-------------|---15%------:+{% for uv in custom.voorz_tabel %}
|{{ uv.text }}|{{ uv.value | currency }}{% endfor %}

{% endcapture %}

{% result "input_voorz_tabel_nl" input_voorz_tabel_nl %}
{% result "voorz_tabel_nl" voorz_tabel_nl %}
{% result "input_voorz_tabel_fr" input_voorz_tabel_fr %}
{% result "voorz_tabel_fr" voorz_tabel_fr %}
<!-- end VOORZIENINGEN -->

<!-- ANDERE -->
{% assign key_title = "title" | append:company.custom.select.language %}
{% assign key_text = "text" | append:company.custom.select.language %}

{% input custom.acc_andere.show as:boolean %} **{% input custom.acc_andere[key_title] default:"Andere" %}**

{% capture input_text_acc_andere_nl %}{% input custom.acc_andere.text_nl as:text size:mini %}{% endcapture %}
{% capture input_text_acc_andere_fr %}{% input custom.acc_andere.text_fr as:text size:mini %}{% endcapture %}

{% assign text_acc_andere_var = "input_text_acc_andere_" | append:company.custom.select.language %}

{{ [text_acc_andere_var] }}

{% result "input_text_acc_andere_nl" input_text_acc_andere_nl %}
{% result "text_acc_andere_nl" custom.acc_andere.text_nl %}
{% result "input_text_acc_andere_fr" input_text_acc_andere_fr %}
{% result "text_acc_andere_fr" custom.acc_andere.text_fr %}
<!-- END ANDERE -->

I also don’t see the problem, the error appears between the titel and the first input row. The template was created a long time ago with no problems and now this appears.

Hi again Peter,

It seems like you are using the namespace (custom.voorz_tabel) on both your variables and foriloop. Try changing both of them and the error should dissapear. For example:

{% input custom.section.show as:boolean %} & {% fori uv in custom.my_collection %}

instead of

{% input custom.voorz_tabel.show as:boolean %}`` & `` {% fori uv in custom.voorz_tabel %}

You can try just changing one but make sure you delete the previous entered information as it might still cause issues on the database.

Best,
Borja

Thanks Borja, It’s OK now in the company I tested, but I don’t know why this problems accurs now, since this template is more than a year old.
Wouldn’t there be a problem now in other companies because they have used always the ‘old boolean’ variable?

Hi Peter,

That’s strange indeed, maybe no data was entered before for that specific template? Do you remember if you updated anything else just before you noticed the liquid error?

Best,
Borja

Hi Borja

No, it was a colleague of my that use this template. Maybe last year it was not used.
Anyway, many thanks

Peter