Circular reference exception when its not a circular reference


I have a non circular exception that shows a circular exception issue. The error message only shows for a third period.

The reconcilliation allows the user to make a sum of 2 values. It transfers the sum to the next period (via the magic of a result field).

On the next period it will take the result of the prior period and makes the sum with 2 other values. (ability to transfer a balance between periods)


The liquid code below is the code snippet on how to cause the issue.

{% assign resfldname = ‘summeduppriorperiod’ %}

{% if period.minus_1y.exists %}
** Found an existing prior period with an amount of **
** allpriorresults = {{ period.minus_1y.reconciliations.cirrefdemo.results[resfldname] | currency }}**

** {% assign transferperiodperiod = period.minus_1y.reconciliations.cirrefdemo.results[resfldname] %}**

{% endif %}

| Name | Input |
| transfer amount | {{ transferperiodperiod | currency }} |
|First value | {% input custom.recondata.avalue as:currency %} |
|_ Second value |{% input custom.recondata.asecondvalue as:currency %} _|
| Sum | {% assign summedup = custom.recondata.avalue+custom.recondata.asecondvalue+transferperiodperiod %} {{ summedup | currency }} |

{% comment %}Storing result in a result field{% endcomment %}
{% result resfldname summedup %}

An expected outcome would be then

It is not intended that this causes a circular reference exception. In fact it is looping till there are no more periods known in Silverfin. Then it should stop.

I’m afraid that the circular reference exception is thrown to fast (and is not able to detect a real circular refernce exception but is thrown when it hits 3 times the same code). This exception does not show in the second period.

When we press the refresh button on the circlular reference exception, we get the correct values. I guess that cached calculations allow us to pass one more step further in the circle.

Is there a way around to avoid this issue. (we developed a recon that is counting on this principle - so we would need something simular)

Best regards

Ruben Moerman

Hi @rumoerman,

Thank you for your question. The issue is that you cannot retrieve the result tag from the same template within itself. It will give you a circular reference. One of the solutions would be to use rollforward function.

Please find an example code here:

| Name | Input |
| transfer amount |{% if period.minus_1y.exists %}{{ custom.recondata.transferperiod | currency }}{% else %}{% input custom.recondata.transferperiod as:currency %}{% endif %}{% assign transferperiodperiod = custom.recondata.transferperiod %} |
|First value | {% input custom.recondata.avalue as:currency %}{% rollforward nil custom.recondata.avalue %} |
|_ Second value |{% input custom.recondata.asecondvalue as:currency %}{% rollforward nil custom.recondata.asecondvalue %} _|
| Sum | {% assign summedup = custom.recondata.avalue+custom.recondata.asecondvalue+transferperiodperiod %} {{ summedup | currency }} |

{% rollforward summedup custom.recondata.transferperiod %}

To retrieve information with rollforward just click Actions->Copy data (from the previous period).

You could find more information on how this function works in the community. If you have any other questions, feel free to post them here!

Kind regards,

Hi Dasha,

Thank you for the explanation.

In the example we refer to the same template but each time the prior period. This is not an unending loop (or circular ref) its limited since the amount of periods in SF are. Its the same code but each time different recon (if you consider 1 recon per period).

With the rollforward do you get changes you make in a prior period? If I’m not mistaken the copy data performs a single shot when you create initially the data in the recon. Not sure if that fit our needs.


Best regards

Ruben Moerman

Hi @rumoerman,

Thanks for coming back!
Unfortunately, due to technicalities you cannot refer to the same reconciliation with the result tag (even if it is in different period).

As for the rollforward function you can copy the details whenever you like. You will then get the updated value for the fixed value (the one you are transferring through the periods) but unfortunately lose your inputted current values in the table since they are rollforwarded as nil.

Another solution would be to store the transferred value in a custom drop and refer to it in current period as period.minus_1y.reconciliations.[handle].custom.variable.value. Therefore, you will solve the issue of both circular reference (with result) and losing your data if adjusted in previous period and copied data again (with rollforward).

Let me know if you need any further assistance.

Kind regards,