Show/hide table using if formula

Hi, I’m attempting to code a table to appear based on the answer to a question.

For example, if the answer is ‘yes’ then I would like the table to then show below the question. For any other answer the table can be hidden.

I have found an example of coding which uses the same logic but instead of a table, shows a text box (see below*):

This is how it shows in the template:

I thought I might need to capture the table and using the code above, link the table where the ‘input’ code is but didn’t have any success.

What is the best coding solution for this?
Thank you.

*Coding for reference:

|{% if custom.checkpoint.c1 == 'Yes'}{% ifi custom.audit.requirement != blank %}Reason why review is required: {% input custom.audit.requirement as:text placeholder:" " %} {% endif %}
{% endstripnewlines %}```

Hi @Mike.davis

Thank you for your question.

The code that you need is very similar to the reference code that you posted.
My example is very generic, but you should be able to use it for your case:

{% stripnewlines %}
| Question:
| {% input custom.example.dropdown as:select options:'Yes|No' %}
{% endstripnewlines %}


{% if custom.example.dropdown == 'Yes' %}
  {% stripnewlines %}
  | Header 1
  | Header 2
  {% newline %}
  |--------
  |--------
  {% newline %}
  | content
  | content
  {% newline %}
  | content
  | content
  {% endstripnewlines %}
{% endif %}

So only if the answer to the question is ‘Yes’, the table within the if-statement will render. You can then tweak the content of the table (content, width, columns…) to make sure that it looks exactly as you want it to.

I hope this clarifies your question.

Kind regards,

Michiel

Thank you very much Michiel, that fixed it!

Kind regards,

Mike