Query on Unexplained tag

Hi,

I am using the bellow template.
If I add an attachment or a description the lines gets reconciled.
If I delete the text or remove the attachment the lines remains reconciled unless i delete entire row.

Can it be set up so it turn red when someone just deletes only the text from description of the attachment by mistake?
Can it be setup to turn red if is missing both the attachment and the description?

{% stripnewlines %} 
{{header}}{% newline %} 
|_**Report**_|_**Description**_|_**Initials**_|_**Date**_{% newline %} 
{% capture attachment1 %}{% fori attachement in custom.attachements_1_1 %} 
| {% input attachement.file as:file_collection %} 
| {% input attachement.description placeholder:"Description" %} 
| {{ attachement.1_1.updated_by.name }} 
| {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }} 
|{% newline %} 
{% endfori %}{% endcapture %} 
| {% if custom.attachements_1_1.size > 0 %}{%assign $1 = 1%}{% unexplained 0 as:indicator %}{% else %}{%assign $1 = 0%}{% unexplained 1 as:indicator %}{% endif %} Accounts 
{% newline %} 
{{attachment1}} 
{% endstripnewlines %} 

Thank you,
Stefan

Hi @Stefan.Temelie,

The feature you might be looking for, is the required attribute. More info on: https://developer.silverfin.com/docs/input#required-attribute.

This attribute makes sure the template becomes unreconciled in case a certain input field hasn’t been filled by the user. An attachment also qualifies as an input field.

You can apply this feature for each input tag you want. Example:

{% input attachement.file as:file_collection required:true %} 
{% input attachement.description placeholder:"Description" required:true %} 

Some additional notes:

  • unexplained is a deprecated tag which may impose unexpected behavior. Use unreconciled instead https://developer.silverfin.com/docs/unreconciled#unreconciled-text-attribute
  • The required attribute will set the entire template to red without the need for a specific indicator somewhere in your template. So you might consider to remove the indicator you are using currently, as the template indicator (on top next to the template title) already functions as such.

Does this help you? Otherwise don’t hesitate to ask.

Hi @Melle

Thank you for your explanation. I was not aware of that attribute but i will definitely use it in the future.

For the above code. If I remove both the attachment and the description the the reconciliation does not change it status. ( screenshot 1)
Only if I delete the row using the trash icon it appears as unreconciled. ( scrrenshot 2)

Is there a way to prevent this from happening ( I mean appear reconciled even if attachment and description are empty) ? Or do I need always to delete the row ?


image

Thank you,
Stefan

Hi @Stefan.Temelie,

Is that really what you want to go for? It seems to me that within the function/goal of your template, it is needed to have both a description and attachment, right?
So we’d propose to make those inputs as required. You can do it with an indicator, but:

A/ that seems a bit of an overkill visually (as the indicator cannot be linked visually to both inputs)
B/ you’d need to create additional coding, as you’d create a variable depending on the outcome of those 2 inputs

Let us know what you’d think; happy to help out further

Hi Sven

I have added a description and it shows reconciled.

I delete the text from description and saved. The indicator is still reconciled. (shows green)

image

Can that line show unreconciled?

Thank you,
Stefan

Could you paste the code you use @Stefan.Temelie? And do you really need an indicator for this (green dot/red triangle)?

Hi Sven,

Is the same as above

{% stripnewlines %}
{{header}}{% newline %}
|_**Report**_|_**Description**_|_**Initials**_|_**Date**_{% newline %}
{% capture attachment1 %}{% fori attachement in custom.attachements_1_1 %}
| {% input attachement.file as:file_collection %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.1_1.updated_by.name }}
| {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }}
|{% newline %}
{% endfori %}{% endcapture %}
| {% if custom.attachements_1_1.size > 0 %}{%assign $1 = 1%}{% unreconciled 0 as:indicator %}{% else %}{%assign $1 = 0%}{% unreconciled 1 as:indicator %}{% endif %} Management letter and supporting schedules
{% newline %}
{{attachment1}}
{% endstripnewlines %}

Thank you,
Stefan

Okay, but you’re still not using the required attribute… It would be better to add those, instead of using the indicator. Is there a specific reason why not to use the required attributes?

In your current code the indicator is even dependant on the amount of attachments or descriptions added, so this piece of code isn’t even looking at a specific input (description OR attachment):

{% if custom.attachements_1_1.size > 0 %}
{% unreconciled 0 as:indicator %}
{% else %}
{% unreconciled 1 as:indicator %}
{% endif %}

above code is basically saying: as soon as you have added at least one description or attachment, the template should reconcile. But that’s not what you want, and you are complicating the code a bit while it could be used way more efficiently with the required-attribute:

| {% input attachement.file as:file required:true %}
| {% input attachement.description placeholder:"Description" required:true %} 

Could you share your thoughts why you wouldn’t use the required logic? Curious about it :thinking:

Hi Sven,

The reason why I am not using required attribute is because it would make both the fields required.

In my template if either the description or the attachment fields are not empty it makes the indicator green.

I just want the indicator to no longer look green if I am deleting the text inside the description or the attachment as shown inthe screenshot bellow.
image

@Stefan.Temelie, please try the following. Please inform us in case it still doesn’t work out the way you want:

{% stripnewlines %}
{{header}}{% newline %}
|_**Report**_|_**Description**_|_**Initials**_|_**Date**_{% newline %}
{% capture attachment1 %}{% fori attachement in custom.attachements_1_1 %}
| {% input attachement.file as:file_collection %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.1_1.updated_by.name }}
| {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }}
|{% newline %}
{% endfori %}{% endcapture %}

New code:

{% assign unrec_argument = 0 %}
{% assign register_argument = 1 %}
{% for attachment in custom.attachements_1_1 %}
  {% if attachment.description == blank or attachment.file == void %}
    {% assign unrec_argument = 1 %}
    {% assign register_argument = 0 %}
  {% endif %}
{% endfor %}

Please update the corresponding line to:

| {%assign $1 = register_argument %}{% unreconciled unrec_argument as:indicator %}

Management letter and supporting schedules
{% newline %}
{{attachment1}}
{% endstripnewlines %}

In addition, my advise is to use as:file instead of as:file_collection as it does the same, but as:file is the version we regularly use.

Hi Melle,

I have tried to do what you have suggested but it seems to have the same behaviour.
Even if I deleted the text inside the Description box the the indicator is still green.
Am I doing something wrong ?

{% stripnewlines %}
{{header}}{% newline %}
|_**Report**_|_**Description**_|_**Initials**_|_**Date**_{% newline %}
{% capture attachment1 %}{% fori attachement in custom.attachements_1_1 %}
| {% input attachement.file as:file %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.1_1.updated_by.name }}
| {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }}
|{% newline %}
{% endfori %}{% endcapture %}
{% assign unrec_argument = 1 %}
{% assign register_argument = 0 %}
{% for attachment in custom.attachements_1_1 %}
  {% if attachment.description == blank or attachment.file == void %}
    {% assign unrec_argument = 0 %}
    {% assign register_argument = 1 %}
  {% endif %}
{% endfor %}
| {%assign $1 = register_argument %}{% unreconciled unrec_argument as:indicator %}
Management letter and supporting schedules
{% newline %}
{{attachment1}}
{% endstripnewlines %}

Thank you,
Stefan

Hi @Stefan.Temelie,

The assign of the unrec_argument nested within the for-loop and if-statement, should be 1 (= not reconciled). In the base case (just before the loop), the unreconciled argument should be 0. In your code snippet, these appear to be swapped, making the base case ‘unreconciled’ and the conditional case ‘reconciled’.

Please let us know if it still doesn’t work!

Hi,

I have swapped them.
If those are not swapped the indicator is green even when there is no information added in either the attachment or description field.
image

{% stripnewlines %}
{{header}}{% newline %}
|_**Report**_|_**Description**_|_**Initials**_|_**Date**_{% newline %}
{% capture attachment1 %}{% fori attachement in custom.attachements_1_1 %}
| {% input attachement.file as:file %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.1_1.updated_by.name }}
| {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }}
|{% newline %}
{% endfori %}{% endcapture %}
{% assign unrec_argument = 0 %}
{% assign register_argument = 1 %}
{% for attachment in custom.attachements_1_1 %}
  {% if attachment.description == blank or attachment.file == void %}
    {% assign unrec_argument = 1 %}
    {% assign register_argument = 0 %}
  {% endif %}
{% endfor %}
| {%assign $1 = register_argument %}{% unreconciled unrec_argument as:indicator %}
Management letter and supporting schedules
{% newline %}
{{attachment1}}
{% endstripnewlines %}

Thank you,
Stefan

@Stefan.Temelie, that only applies in case there are no lines in your fori loop. Note that you always see one ‘input line’ but that still means there are 0 lines in your loop. I may have wrongly assumed that no lines also means it is ok/reconciled, and only an empty line with either one of the inputs missing should lead to an ‘unreconciled’ indicator.

It is possible however to also make the base case for unrec_argument conditional. For instance by replacing it with:

{% assign unrec_argument = 1 %}
{% if custom.attachements_1_1.size > 0 %}
    {% assign unrec_argument = 0 %}
{% endif %}

Which makes the base case equal to ‘unreconciled’ and line items need to be entered (and equipped with input) in order for the argument to become 0.

Hi,

I am not sure if I have done something wrong but I get the same behaviour as before.
image

{% stripnewlines %}
{{header}}{% newline %}
|_**Report**_|_**Description**_|_**Initials**_|_**Date**_{% newline %}
{% capture attachment1 %}{% fori attachement in custom.attachements_1_1 %}
| {% input attachement.file as:file %}
| {% input attachement.description placeholder:"Description" %}
| {{ attachement.1_1.updated_by.name }}
| {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }}
|{% newline %}
{% endfori %}{% endcapture %}
{% assign unrec_argument = 1 %}
{% if custom.attachements_1_1.size > 0 %}
    {% assign unrec_argument = 0 %}
{% endif %}
| {%assign $1 = register_argument %}{% unreconciled unrec_argument as:indicator %}
Management letter and supporting schedules
{% newline %}
{{attachment1}}
{% endstripnewlines %}

Is there a way to make the indicator red if the information inside the line in fori loop is empty?

Thank you,
Stefan

Hi Stefan

I’ve adjusted the check so it will show as a red triangle if:

1/ No lines are added
2/ A description is added, but an attachment is missing
3/ An attachment is added, but a description is missing

I hope these are the right cases you wanted to cover, this is the code snippet for the check of the unreconciled:

{% assign unrec_argument = 0 %}
{% assign register_argument = 1 %}
{% if custom.attachements_1_1.size < 1 %}
  {% assign unrec_argument = 1 %}
{% else %}
  {% for attachment in custom.attachements_1_1 %}
    {% if attachment.description == blank or attachment.file.documents.size < 1 %}
      {% assign unrec_argument = 1 %}
      {% assign register_argument = 0 %}
    {% endif %}
  {% endfor %}
{% endif %}

And this is the full code I used to test:

{% capture header %}
|---------
|---------
|---------
|---------+
{% endcapture %}

{% stripnewlines %}
{{ header }}
{% newline %}
|_**Report**
_|_**Description**
_|_**Initials**
_|_**Date**_
{% newline %}
{% capture attachment1 %}
  {% fori attachement in custom.attachements_1_1 %}
    | {% input attachement.file as:file %}
    | {% input attachement.description placeholder:"Description" %}
    | {{ attachement.1_1.updated_by.name }}
    | {{ attachement.1_1.updated_at | date:"%d/%m/%Y %H:%M" }}
    {% newline %}
  {% endfori %}
{% endcapture %}

{% assign unrec_argument = 0 %}
{% assign register_argument = 1 %}
{% if custom.attachements_1_1.size < 1 %}
  {% assign unrec_argument = 1 %}
{% else %}
  {% for attachment in custom.attachements_1_1 %}
    {% if attachment.description == blank or attachment.file.documents.size < 1 %}
      {% assign unrec_argument = 1 %}
      {% assign register_argument = 0 %}
    {% endif %}
  {% endfor %}
{% endif %}
| {%assign $1 = register_argument %}{% unreconciled unrec_argument as:indicator %}
Management letter and supporting schedules
{% newline %}
{{attachment1}}
{% endstripnewlines %}

I hope this helps you further!

Kind regards
Wouter

Hi Wouter,

I want the green triangle
1 A description is added
OR
2 An attachment is added.
OR
3 I have both a description and an attachment.

If the Line has both the attachment and description empty it should be red.

Thanks,
Stefan

I see, then you should be able to achieve this by changing this line in the code above from an OR statement to an AND statement:

{% if attachment.description == blank and attachment.file.documents.size < 1 %}

Kind regards
Wouter