CASE: show text on an indicator

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.

:bulb:
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 %} 

Hey Sven, do you know if you can add text over a reconciled icon as well? (green dot) Thanks - Pete

Hey @pgallagher,

I’m afraid not. May I ask why you’d want this?

1 Like

I was trying to do integrity checks of calculations & numbers across templates. And I know we can add hover text if something does not reconcile. But was thinking it would be nice to have hover text over if it does reconcile as well so the user/review would be able to know information or have text on what exactly is being reconciled

Hey @pgallagher,

May I suggest using an infotext instead then (as a hover)? As I don’t think anyone has the impuls to hover over a green dot. :slightly_smiling_face:

1 Like

yes, thank you. That’s exactly what we ended up doing. And if it didn’t reconcile, we ended up outputting a warning text icon with hover showing/explaining any differences