CASE: how to customise the title of your input fields on the import reconciliation data screen

Have you ever wanted to change the titles in the import reconciliation data screen :question:

We are here to help you :ok_hand:

First things first, when I said “Import reconciliation data” I was referring to the action you can find on the input view on your templates:

image

This specific action allows you to import data from excel into a fori loop collection inside your template by mapping each column to a specific input field. You can find more information on how to use this action here.

Let’s have a look at all possible scenarios:


1- Placeholder is not present


By default the titles for each input field to be mapped come from the key of your variable name (i.e. the "key" in "custom.namespace.key"). The "key" will be capitalised and underscores will become spaces.

Let’s say you have the following code:

{% fori employee in custom.employees %}
  {% input employee.name %}
  {% input employee.date_of_birth %}
{% endfori %}

Then your import reconciliation data screen will look like this:


2- The placeholder attribute is used in the input field


If your input field has a placeholder attribute, this will replace the name of the key on the import reconciliation data screen.

For example:

{% fori employee in custom.employees %}
  {% input employee.name %}
  {% input employee.date_of_birth as:date placeholder:'dd/mm/yyyy' %}
{% endfori %}

The above will be presented like this:


3- The import_title attribute is used in the input field


As you can see, scenario number 2 can present some issues as you might want a placeholder for a date that looks like dd/mm/yyyy but this does not make much sense for someone trying to map that input field.

For those situations, we have another attribute called import_title that will overwrite the key/placeholder names on the reconciliation field column.

For example:

{% fori employee in custom.employees %}
  {% input employee.name %}
  {% input employee.date_of_birth as:date placeholder:'dd/mm/yyyy' import_title:'Date of birth' %}
{% endfori %}

This will be shown as:


N.B.

  • Bear in mind that the above only applies for inputs inside a custom fori loop as the “Import reconciliation data” action only works for custom collections
  • The import_title attribute will automatically capitalise the first letter of the string and lower-case the rest (e.g. import_title:'date of BIRTH' will become “Date of birth” on the reconciliation field column)