For Loop not iterating multiple rows for line items when user does not belong to Admin role. For Loop in the Admin role works fine.
Example iFrame Block HTML Liquid Template code snippet:
{% capture descr_array %}
{% for description in ctx.popup.record.colines_id limit:1 %}
{{ ctx.popup.record.colines_id.description }}
{% endfor %}
{% endcapture %}
{% assign descr_list = descr_array | split: "," %}
{% for descr in descr_list %}
<div style="text-align: left;">{{ descr }}</div>
{% endfor %}
When user is a member of the Admin role, the above code snippet produces the following example output, which is correct with one item per row:
Space Temperature Sensors
Zone Pressure Sensors
Transformer
Controller
Wire/misc install materials
Field labor
Engineering labor
10% markup
When user is not a member of the Admin role, the output incorrectly displays the items all on one row as follows:
Space Temperature SensorsZone Pressure SensorsTransformerControllerWire/misc install materialsField laborEngineering labor10% markup
After some research, I found the problem was introduced in v2.1.37, and all versions afterwards. In v2.1.36, this was not an issue regardless of user role permissions.
I think a workaround would be to use a JS block instead of iframe
Thanks for the investigation and the exact v2.1.37 boundary - we can now confirm the cause. Since v2.1.37, variable resolution is role-scoped: roles with configuration access get unrestricted resolution, while regular roles are limited to an allow-list built from the {{ … }} expressions in the block. Because your collection variable is used inside a {% for %} tag rather than a {{ … }} expression, the association path is missing from the non-admin allow-list, so ctx.popup.record.colines_id is not resolved as an array, the comma-join your split relies on never happens, and everything collapses into one row.
Use this template, which works for both roles:
{% assign list = ctx.popup.record.colines_id.description %}
{% if list.first %}
{% for d in list %}
{{ d }}
{% endfor %}
{% else %}
{% assign parts = list | split: “,” %}
{% for d in parts %}
{{ d }}
{% endfor %}
{% endif %}
It iterates the array when the value is a list and falls back to splitting the joined string otherwise. We are treating this as a regression in role-scoped variable resolution and not a configuration problem on your side. Iframe block docs: https://docs.nocobase.com/interface-builder/blocks/other-blocks/iframe
Sorry for the late reply on this. Thanks for looking into the issue.
However, when I tried applying your template suggestion, It only displayed the list correctly as an Admin role member, and no list was displayed at all when logged in as a non-Admin member.
My sample code below:
{% assign list = ctx.popup.record.colines_id.description %}
{% if list.first %}
{% for d in list %}
<div style="text-align: left;">{{ d }}</div>
{% endfor %}
{% else %}
{% assign parts = list | split: "," %}
{% for d in parts %}
<div style="text-align: left;">{{ d }}</div>
{% endfor %}
{% endif %}
I appreciate the help with this.