Forum Discussion
How interesting. I just had to solve this problem the other night.
To get a more succinct Jinja2 expression you'll want to use combinations of following filters:
If I understand your schema correctly, the expression for the first issue (where you are simply writing to a text field) would look like this:
{{ d.custom_fields | selectattr('key', 'eq', 'street') | map(attribute='value') | join('') }}
The second problem may be a little less elegant because there isn't a way that I know of to combine multiple lists using jinja2.{% for choice in d.custom_fields | selectattr('key', 'eq', 'choices') -%}
{{ choice.value | join(';') -}}
{% if not loop.last %};{% endif -%}
{% endfor -%}
The important part to remember about multi-select text is that a semicolon should be used as a delimiter (unless you are posting the data directly via the RESTful API).
Here is a live parser that allows you to test with json instead of only YAML.
https://j2live.ttl255.com/
------------------------------
Justin Torrence
Quickbase Expert, Jaybird Technologies
jtorrence@jaybirdtechnologies.com
https://www.jaybirdtechnologies.com/#community-post
------------------------------
Hi Justin,
Many thanks for the more succinct way of extracting the value from the nested JSON array. And thanks for the explanation and the link, they are most useful. 🌷
I've opened a case with Quickbase to examine why the array is flattened to a Python string representation in the first place. Will update if there are any conclusions.
Cheers,
Uri
------------------------------
Uri Goldstein
------------------------------