{%- set i = namespace(x=0) -%}
{%- set table = [] -%}
{%- for dev in vars.device_record_data -%}
{%- set idx = {} -%}
{%- if vars.steps.render_jinja[i.x].output not in ["", false] -%}
{%- set ret = true -%}
{%- endif -%}
{%- set _do = idx.update( {
"ztp_profile_id":vars.ztp_profile_id,
"id":dev.id,
"matched": ret|default(false),
"jinja_vars":vars.steps.get_jinja_vars[i.x].output,
"jinja_search":vars.zprof_search
} ) -%}
{%- set _do = table.append(idx) -%}
{%- set i.x = i.x+1 -%}
{%- endfor -%}
{{table}}
https://github.com/fortinet-fortisoar/solution-pack-fortimanager-ztp-framework/blob/a986b3f0defa2419e956edb85c3f92620c5a23dc/playbooks/10%20-%20SP%20-%20FortiManager%20ZTP%20Flow%20-%20FortiManager(FMG)-RecordHandlers/_%20ztp%20profile%20assignment%20search.json#L40
The jinja here only checks if the result output of the jinja render is not equal to an empty string
One thing i saw is that even if i am returning false from jinja, that the ztp profile was still matching it
devmeta
I have gotten the desired behavior working with