Ever wondered why an indicator shows up in a template? Sure, we all know when hovering over an indicator (a red triangle) it shows the difference between values. But that’s about it.
No more though, as you can add the unreconciled_text to your code explaining with text and numbers why an indicator is showing, like this:
{% unreconciled some_value as:indicator unreconciled_text:some_var %}
This is a game-changer, as you are not forced to create additional warning texts! Cases are endless:
- show an indicator when a value has to be positive
- shown an indicator is an input cannot be empty
- shown an indicator with the formula we use to get to be reconciled or not
- …
A preview (easy example though):
Example code:
{% assign accounts = #70 %}
{% stripnewlines %}
| Account link
| Value
{% newline %}
|----80%----
|----20%----:#
{% for acc in accounts %}
{% newline %}
| {{ acc.link }}
| {{ -acc.value | currency }}
{% if forloop.last %}
{% newline %}
| **{% t "Total" %}**
| **{{ -accounts.value | currency }}**
{% endif %}
{% endfor %}
{% endstripnewlines %}
<br>
{% ic %}{::infotext}
{% t "document VAT segments" %}
{:/infotext}{% endic %}
{% stripnewlines %}
|----85%----
|----15%----:+
{% fori item in custom.vat_segments %}
{% newline %}
| {% input item.description placeholder:"Descr." %}
| {% $1+input item.value as:currency %}
{% comment %}create an indicator saying which value needs to be reconciled{% endcomment %}
{% assign value_a = -accounts.value %}
{% assign value_b = $1 %}
{% if value_a != value_b %}
{% assign diff = value_a-value_b %}
{% endif %}
{% capture diff_txt %}Difference is {{ diff | currency }}, as the original value is {{ value_a | currency }} while the details of the VAT segments have a total of {{ value_b | currency }}{% endcapture %}
{% if forloop.last %}
{% newline %}
|
|_^ {% unreconciled diff as:indicator unreconciled_text:diff_txt %}
{{ $1 | currency }} ^_|
{% endif %}
{% endfori %}
{% endstripnewlines %}
This does the trick:
{% unreconciled diff as:indicator unreconciled_text:diff_txt %}
We’ll use a combination of standard text with variables and put them into one variable with the capture tag:
{% capture diff_txt %}Difference is {{ diff | currency }}, as the original value is {{ value_a | currency }} while the details of the VAT segments have a total of {{ value_b | currency }}{% endcapture %}