Custom template

Hi,

Can you please let me know if any of the two are possible and advise how I can achieve this?

1 To see unreconciled indicators at the top of the table instead of showing after each questions

2 To add a new dropdown at the top of the table. Once the check option is selected at the top of the table, to make all the following check options the same.
Ex: If I select “NA” at the top , the check options from the table to change to N/A

Below you can see my current template.

{% capture header_check %}|--57%--|--9%--|--3%--|--30%--+{% endcapture %}
{% capture check_options %}Yes|No|N/A|Not Known{% endcapture %}
{% capture questions_array2 %}Question1 |Question2|Question3
{% endcapture %}
{% assign questions_array2 = questions_array2 | split:'|' %}

{% stripnewlines %}
  |Show reconciled indicators here
  | 2nd question. dropdown here
  |Note
{% newline %}
{{header_check}} {% newline %}

{% for question in questions_array2 %}
  |{{question}} 
  |{% input custom.input2.[forloop.index] as:select options:check_options option_values:"1|2|3|4" %} 
  |{% assign value_indicator = 1 %}
    {% if custom.input2.[forloop.index] == 1  or custom.input2.[forloop.index] == 2 or custom.input2.[forloop.index] == 3 %} {% assign value_indicator = 0 %}
  {% endif %}
  {% if custom.commentsI2.[forloop.index] != blank and  custom.input2.[forloop.index] == 4 %}{% assign value_indicator = 0 %}
  {% endif %}
  {% unreconciled value_indicator as:indicator %}
  |{% input custom.commentsI2.[forloop.index] as:text  placeholder:"Add note" %}
  {% newline %}
{% endfor %} 
{% endstripnewlines %}

Thank you for your time.
Stefan

Hi @Stefan.Temelie,

Thank you for visiting the community and thank you for providing a clear and short example! Your first question is possible but it depends on when you would like to see the unreconciled tag. In case you want to see it when at least one of the questions is unreconciled, the following code can be a solution. You first loop over the collection to check whether all lines in the table are reconciled.

{% capture header_check %}|--57%--|--9%--|--3%--|--30%--+{% endcapture %}
{% capture check_options %}Yes|No|N/A|Not Known{% endcapture %}
{% capture questions_array2 %}Question1 |Question2|Question3
{% endcapture %}
{% assign questions_array2 = questions_array2 | split:'|' %}

{% assign value_indicator = 0 %}

{% for question in questions_array2 %}
  {% if custom.input2.[forloop.index] == blank and custom.dropdown.default == blank %}
    {% assign value_indicator = 1 %}
  {% elsif custom.input2.[forloop.index] == 4 and custom.commentsI2.[forloop.index] == blank %}
    {% assign value_indicator = 1 %}
  {% elsif custom.input2.[forloop.index] == blank and custom.dropdown.default == 4 and custom.commentsI2.[forloop.index] == blank %}
    {% assign value_indicator = 1 %}
  {% endif %}
{% endfor %}

{% stripnewlines %}
  |Show reconciled indicators here  {% unreconciled value_indicator as:indicator %}
  | 2nd question. dropdown here {% input custom.dropdown.default as:select options:check_options option_values:"1|2|3|4"  %}
  |Note    
{% newline %}
{{header_check}} {% newline %}

{% for question in questions_array2 %}
  |{{question}} 
  |{% input custom.input2.[forloop.index] as:select options:check_options option_values:"1|2|3|4" default:custom.dropdown.default %} 
  |{% assign value_indicator = 1 %}
  |{% input custom.commentsI2.[forloop.index] as:text  placeholder:"Add note" %}
  {% newline %}
{% endfor %} 

{% endstripnewlines %}

Remark that it also contains a solution for your second question. There is a dropdown in the header which serves as a default for the dropdowns below. Note that if the dropdowns in the table itself are not blank, they no longer look at the default in the header.

I also want to point your attention to the name of the custom variables you are using. For the first question the name of the custom variable would be custom.input2.1, for the second one custom.input2.2. When you would like to delete the first question in the future, the second question becomes number one, however the naming in the database will not update! Questions and answers will no longer match.

A solution can be to create a sort of key array that can be used in your custom variable names. [This community post](CASE: array of questions with checks informs you on how to do this.

Kind regards,

Michiel

Hi Michael,

Thank you for your help.
Can you confirm if I understood correctly ?
In case I want to add/remove a question is better to have a key array for each custom variable. For my example since I use a custom.dropdown and custom.commentsI2 it would be better to have to two sorts of key array. In this way my selection in Dropdown is remembered for each question and also the “Notes” i have added ?

I
I have checked the community post and tried to update the template. Can you advise on what I do wrong ? In the example from the screenshot below I have added the Question5, Answer5 and Note5 later on.

{% capture header_check %}|--57%--|--9%--|--3%--|--30%--+{% endcapture %}
{% capture check_options %}Yes|No|N/A|Not Known{% endcapture %}
{% capture questions_array2 %}Question1 |Question2|Question5|Question3|Question4
{% endcapture %}
{% capture questions_array2answer %}Answer1|Answer2|Answer5|Answer3|Answer4
{% endcapture %}
{% capture questions_array2note %}Note1 |Note2|Note5|Note3|Note4|
{% endcapture %}


{% assign questions_array2 = questions_array2 | split:'|' %}
{% assign questions_array2answer = questions_array2answer | split:'|' %}
{% assign questions_array2note = questions_array2note | split:'|' %}


{% assign value_indicator = 0 %}



{% for question in questions_array2 %}
  {% if custom.input2.[forloop.index] == blank and custom.dropdown.default == blank %}
    {% assign value_indicator = 1 %}
  {% elsif custom.input2.[forloop.index] == 4 and custom.commentsI2.[forloop.index] == blank %}
    {% assign value_indicator = 1 %}
  {% elsif custom.input2.[forloop.index] == blank and custom.dropdown.default == 4 and custom.commentsI2.[forloop.index] == blank %}
    {% assign value_indicator = 1 %}
  {% endif %}
{% endfor %}

{% stripnewlines %}
  |Show reconciled indicators here  {% unreconciled value_indicator as:indicator %}
  | 2nd question. dropdown here {% input custom.dropdown.default as:select options:check_options option_values:"1|2|3|4"  %}
  |Note    
{% newline %}
{{header_check}} {% newline %}

{% for question in questions_array2 %}
  |{{question}} 
       {{ questions_array2answer[forloop.index0] }} 
  |{% input custom.input2.[forloop.index] as:select options:check_options option_values:"1|2|3|4" default:custom.dropdown.default %} 
  |{% assign value_indicator = 1 %}
   {{ questions_array2note[forloop.index0] }} 
  |{% input custom.commentsI2.[forloop.index] as:text  placeholder:"Add note" %}
  {% newline %}
{% endfor %} 

{% endstripnewlines %}

Hi @Stefan.Temelie ,

I see the custom variables are still having the forloop indexes in their names. In the code below you can see that i created a real key array (in real life cases this should be a logical name based on the actual questions, as you can also see in the case mentioned).
The values of this key array are then used as the variable part in the name of the custom variables.

{% capture header_check %}|--57%--|--9%--|--3%--|--30%--+{% endcapture %}
{% capture check_options %}Yes|No|N/A|Not Known{% endcapture %}
{% capture questions_array2 %}Question1 |Question2|Question5|Question3|Question4{% endcapture %}
{% capture questions_array2_key %}Question1_key|Question2_key|Question5_key|Question3_key|Question4_key{% endcapture %}
{% capture questions_array2answer %}Answer1|Answer2|Answer5|Answer3|Answer4{% endcapture %}
{% capture questions_array2note %}Note1 |Note2|Note5|Note3|Note4|{% endcapture %}


{% assign questions_array2 = questions_array2 | split:'|' %}
{% assign questions_array2answer = questions_array2answer | split:'|' %}
{% assign questions_array2note = questions_array2note | split:'|' %}


{% assign value_indicator = 0 %}



{% for question in questions_array2 %}
  {% capture question_key %}questions_array2_key[forloop.index0]{% endcapture %}
  {% if custom.input2.[question_key] == blank and custom.dropdown.default == blank %}
    {% assign value_indicator = 1 %}
  {% elsif custom.input2.[question_key] == 4 and custom.commentsI2.[question_key] == blank %}
    {% assign value_indicator = 1 %}
  {% elsif custom.input2.[question_key] == blank and custom.dropdown.default == 4 and custom.commentsI2.[question_key] == blank %}
    {% assign value_indicator = 1 %}
  {% endif %}
{% endfor %}

{% stripnewlines %}
  |Show reconciled indicators here  {% unreconciled value_indicator as:indicator %}
  | 2nd question. dropdown here {% input custom.dropdown.default as:select options:check_options option_values:"1|2|3|4"  %}
  |Note    
{% newline %}
{{header_check}} {% newline %}

{% for question in questions_array2 %}
  {% capture question_key %}questions_array2_key[forloop.index0]{% endcapture %}
  |{{question}} 
       {{ questions_array2answer[forloop.index0] }} 
  |{% input custom.input2.[question_key] as:select options:check_options option_values:"1|2|3|4" default:custom.dropdown.default %} 
  |{% assign value_indicator = 1 %}
   {{ questions_array2note[question_key] }} 
  |{% input custom.commentsI2.[question_key] as:text  placeholder:"Add note" %}
  {% newline %}
{% endfor %} 

{% endstripnewlines %}

Kind regards,

Michiel

Hi Michael,

The above code applies same dropdown answer to all of my questions and adds same comment everywhere regardless of where I enter it .

As an Output i am interested only in seeing each question, what was selected in the dropdown and the comment added in the Note.

Thank you.
Stefan

Hi Stefan,

Indeed, I missed two things here:

  1. the array created needs to be splitted
  2. questions_array2_key[forloop.index0] needs to be printed in the capture statement, so it becomes like this: {{ questions_array2_key[forloop.index0] }}

Kind regards,

Michiel

Thank you for all your help.

I have one more question about this code.

Is it possible to create a “reset” button that would restore everything to the default options ?

Ex: someone copied this template from one period to another. and wants to reset all the dropdowns or note to the default .

Thank you,
Stefan

Glad we could be of assistance for you Stefan :ok_hand:

To reset input variables, you can with the rollforward function. See below case:

However, you speak of resetting the default value, which begs the question why have a default value in the first place? :thinking:
Unless that default is period bounded? If so, be aware of resetting that default from a certain period too (if not, that default will always populate that input no matter if your rollforward resets the input variable).

Hi Sven,

The rollforward will make all values not to be carried over from one period to another everytime (as far as I know).

What I am interested in is an option to reset the answers/notes from the template in that specific period ( only if is want to, for a particular client, and in a particular period)

I chose my words poorly … I do not have any defaults in the template. By default i meant for clear all answers selected in the dropdown and to delete the text from the notes.

Hope it makes more sense now.

Thank you,
Stefan

Ah, that is what you meant :relaxed:

In contrast of an account template (where you do have the option to delete all details), one cannot do that for a reconciliation.

Good news it we do have this on our backlog, but in the mean time it’s manual work to delete it all (something we developers need to do from time to time for testing purposes I’m afraid)

Thank you both for all the help.

Have a great week.

Stefan