HubL - query_dict - get keys and values

hi all

if i print the query_dict i would get this:

{yr=2014, onoff=0}

i would like to get the

keys

as well as the values for further use but manage only to get the values. how could i read the key’s?

1 |

yr

| 2014
2 |

onoff

| 0

unfortunately this did not work:

{% for

key

, value in request.query_dict %}
{{ loop.index }} | {{

key

}} | {{ value }}<br>
{% endfor %}

Hey @diavolino are you still having difficulty? Are you able to select deal stage before creating a new deal?

Can confirm, this only returns the values, not the keys

@diavolino I think you forgot the “.items()”. Try this:

{% for key, value in request.query_dict.items() %}
 {{ loop.index }} | {{ key }} | {{ value }}<br>
{% endfor %}

Thanks @stefen , that worked. Is there no documentation on this anywhere? The only reference I found on the hubl documentation is for the general request.query_dict term.

@dannio it’s on the loops page here: For Loops - HubSpot docs :wink:

Ahh yes, I missed the “.items()” part. Too used to other languages not having it!

Thanks a lot!