-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iterating over double nested structures #121
Comments
You should just be able to do the following: (render
"{% for i in res %}
{{i.a}}
{{i.b}}
{% for j in i.c %}
{{j.aa}}
{{j.bb}}
{{j.cc}}
{% endfor %}
{% endfor %}"
{:res
[{:a "A1"
:b "B1"
:c [{:aa "AA1"
:bb "BB1"
:cc "CC1"}
{:aa "AA2"
:bb "BB2"
:cc "CC2"}
{:aa "AA3"
:bb "BB3"
:cc "CC3"}]}
{:a "A2"
:b "B2"
:c [{:aa "AA11"
:bb "BB11"
:cc "CC11"}
{:aa "AA21"
:bb "BB21"
:cc "CC21"}
{:aa "AA31"
:bb "BB31"
:cc "CC31"}]}]})
=>
"
A1
B1
AA1
BB1
CC1
AA2
BB2
CC2
AA3
BB3
CC3
A2
B2
AA11
BB11
CC11
AA21
BB21
CC21
AA31
BB31
CC31
" |
Thanks, as I thought. Accessing nested structures works fine for non-dotted (that is, non Datomic) keywords but doesn't work for dotted even if the 'double dot' escape I added is used. However, the double-dotted notation does work for non-nested access. I will have a dig and see why this may be. If you have any pointers to specific files/functions much appreciated. Expect another pull request in due course. Thanks for your help, |
Yeah, I thought your last pr would've addressed that, but maybe the for tag is working around it. Might be a good place to start. Thanks for spearheading this! |
Hi
I have the following structure, passed to Selmer as variable 'res':
I want to iterate over the items in the first vector and print them out, and when getting to the ':c' fields I want to then start an inner iteration to print out the contents.
At the moment it is possible to get to every element in the structure with dotted notation. However, when I introduce an iterator using {% for n in res %} I then can not repeat this for the inner vector. Is this a lacking feature or am I not seeing the bigger picture? Thanks
The text was updated successfully, but these errors were encountered: