0 votes
in Rock by TinaStephens (8.6k points)
edited

How do I set a PDF generated from a workflow to only show questions that have entered values?

enter image description here

2 Answers

0 votes
by TinaStephens (8.6k points)
edited
 
Best answer

In the lava use something like this to hide questions that don't have an answer: (lava written by David Turner)

{% assign whenDidYouSurrender = Workflow | Attribute:'Whendidyousurrender' %}
{% if whenDidYouSurrender and whenDidYouSurrender != '' %}
    When did you Surrender: {{ whenDidYouSurrender }}
{% endif %}

0 votes
by (13.1k points)
edited

Originally posted by Unknown

Use the lava below to only show attributes in the workflow form that have values.

*Be sure to update the form Id in the lava so that it pulls the correct form attributes.

<html>
    <head>
        <style>

            html {

            }
            body {
                margin: 24 125px;
                font-family: Arial, 'OpenSans';
                color: #000;
            }
        </style>
    </head>
    <body>

    <br/>
    <h1>{{ Workflow.Name }}</h1>


    {% workflowactionform where:'Id == 107' %}
        {% for form in workflowactionformItems %}
            {{form.Header}}
            <br/>
            <br/>
            <table>
            <tr>
                <td>
                    <strong>Date</strong>
                </td>
            </tr>
            <tr>
                <td>
                    {{ 'Now'  | Date:'MMMM d, yyyy' }}
                    <br/><br/>
                </td>
            </tr>
            {% for attribute in form.FormAttributes %}

                {% assign attributeValue = Workflow | Attribute:attribute.Attribute.Key %}
                {% assign string = attributeValue | Size %}
                {% if attribute.IsVisible == true %}
                {% if string > 0 %}
                                <tr>
                        <td>
                            {% assign preHtml = attribute.PreHtml | StripNewlines | StripHtml | Replace:' ', '' %}
                            {% if attribute.HideLabel == true and preHtml != empty %}
                                <strong>{{attribute.PreHtml | StripNewlines | StripHtml }}</strong>
                            {% else %}
                                <strong>{{ attribute.Attribute.Name }}</strong>
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <td>
                               {{ Workflow | Attribute:attribute.Attribute.Key }}
                            <br/><br/>
                        </td>
                    </tr>
                {% endif %}
                {% endif %}

            {% endfor %}

            {{form.Footer}}

        {% endfor %}
    {% endworkflowactionform %}

</table>

    </body>
</html>
Welcome! Here you can ask questions and receive answers (hopefully) from other members of our team.
...