CASE: keep copy data in mind when creating database variables

This case is to inform you if you create database variable (so inputs) that are not linked to the template they are shown.

An example will make this a bit more clear:
let’s say we show some accounts in a reconciliation (accessing info from the account-drop) together with a certain input.

Because you access the account drop, you could make the database variable as part of the account drop, as such:

{% assign bank_accounts = #5 %}

{% stripnewlines %}
| Account
| Comment 
{% newline %}

{% for account in bank_accounts %}
  {% newline %}
  | {{ }}
  | {% input as:text placeholder:"Additional comment" %}
{% endfor %}
{% endstripnewlines %}

As you can see, the input is part of the account-drop:

{% input as:text placeholder:“Additional comment” %}

However, if you would choose to copy data from this reconciliation, the data of this input will never be copied.

Why is that, you might wonder? :thinking:
Well, the copy data action of a template only copies data of that template.
So if you have a reconciliation for example, it will only copy data that is linked to that reconciliation (as in: any custom variable such as custom.some.thing or any variable part of custom.some_collection)

In our example the inputs are in fact part of the account drop, and not of the reconciliation (which means you’d need to copy data from the account template details, to get that working).

If you need to behave the copy data as expected (so in our case from within the reconciliation), you need to make your inputs part of the reconciliation instead of the account drop.

Here’s how:

{% for account in bank_accounts %}

  {% comment %}create db var linked to ID of an account so info can get copied from recon{% endcomment %}
  {% capture acc_id %}acc_{{ }}{% endcapture %}

  {% newline %}
  | {{ }}
  | {% input custom[acc_id].add_comment as:text placeholder:"Additional comment" %}
{% endfor %}

So we create custom variables linked to the reconciliation (as they are made like custom.some.thing), while the name of the input has a variable part in it:


Other examples might be:

  • reconciliation with variables from period-drop

For example: if you built a reconciliation with all the inputs related to the period.people drop, then those info can only be copied with this action:

Exactly, data related to the people drop cannot be copied from inside the reconciliation

This may sound a bit much, but the case should make clear that whenever you diverge from custom variables that are not linked to the template anymore, it affects the copy data action from that same template.