Page 1 of 1

LISE Compare a value

Posted: Thu May 25, 2023 8:34 am
by webform
I'm using LISE to store weight reports for projects, and need to compare the weight between 2 weight reports and show the difference in percentage.

I have the equation to use, but is stuck how i get the weight value from each report to calculate.

Code: Select all

{math equation='((x-y)/y*100)' x=$weight1 y=$weight2 format='%.2f' assign='difference'}
I always have 2 reports to compare/calculate, so i'm thinking i'll need to do something like this:

Code: Select all

{if $smarty.foreach.foo.first}
{assign var="weight1" value=$item->fielddefs.weight.value}
{else}
{assign var="weight2" value=$item->fielddefs.weight.value}
{/if}
But is unsure if this is the best way to do it?

Any suggestions are greatly appreciated.