Lava Example - 61 | Rock Community

Lava Example - 55


Prompt

Our church asked recently if they could show all of a person's attributes, instead of just the attributes that have a value.

Of course we don't want to have to hand-code a list of all of the available attributes.

Use Ted as an example, and use the AttributeValues property to do this.

(Note: the nested properties you want are AttributeName and ValueFormatted).

Initial Code
{% assign ted = 5 | PersonById %}
<ol>
    {% for attribute in ted.AttributeValues %}
    {% endfor %}
</ol>
Solution Lava
{% assign ted = 5 | PersonById %}
<ol>
    {% for attribute in ted.AttributeValues %}
        <li>{{ attribute.AttributeName }}: {{ attribute.ValueFormatted }}</li>
    {% endfor %}
</ol>