Forum Discussion
DougHenning1
2 years agoCommunity Manager
The jinja isn't working as you expect because you need to use a namespace to access variables inside a for loop:
{% set target_gid = "1205664665921946" -%}
{% set ns = namespace(url='') -%}
{% for custom_field in c.data_0.custom_fields -%}
{% if custom_field.gid == target_gid -%}
{% set ns.url = custom_field.display_value|string -%}
{% endif -%}
{% endfor -%}
{{ ns.url }
Also, you should add a hyphen before the closing statement tags (see code above) to suppress line breaks otherwise you'll have a bunch of blank lines before the final value.
Hope that helps!
------------------------------
Doug Henning
------------------------------