Hello, I need to create a report that shows the total amount of an income statement if the total amount is positive. If the total is negative, then there may not appear a value and the value should be in another line.
Hi @Annelies and welcome to the Silverfin developer community!
Can you share the piece of liquid code you are struggling with?
It would be a matter of creating two if-statements with the opposite conditions.
{% if amount < 0 %} … {% endif %} and {% if amount >= 0 %} … {% endif %}
One where you want to show the amount if negative, and another where you want to show the amount if it’s positive or zero.
Kind regards
Romy
Until today an excel was used to draw up a specific P&L reporting. If the amount is positive, it need to be shown in the line ‘postive result’ (otherwise 0) and if it is negative, in the line ‘negative result’ (otherwise 0). I used the type formule to build the line in the report but can’t add an if-formula.
Hi @Annelies
So if I understand correctly you are not building a template in liquid, but using the report functionality?
I don’t think you can build conditions into those reports.
This article lists the possibilities for formulas in reports.
KR
Romy
Not sure if it will work, but try this:
result * (result < 0)
And
result * (result > 0)
The part (result < 0) or (result > 0) will give True or False, but in calculations this changes in the value 0 or 1 wich you then multiply with the result
The sign > don’t work in the formula field in the reports.