You are viewing limited content. For full access, please sign in.

Question

Question

Form Table Calculations - Sum row if value = true

asked on June 2, 2021

I have a table I want to sum all the values in a row, but only if a specific value in the table is "true". 

In my situation there is the base price, and if the application is late, then there is an additional fee. So if the application is on time than the fee is the base price. However if the application is late, than the application now costs the original base price plus the late fee.

 

So the calculations would be below: 

When Late=False, than Price = Base Price

When Late=True, than Price = Base Price + Late Fee

 

I have these set up in a table in the same row, but I don't know how to add them across the row for the total. The sum of the row would go in the CalcMasked at the end of the row.

 

 

0 0

Replies

replied on June 2, 2021

Go to the advance section of the field options and under calculation you'll want to use something like this:

IF(EQ(INDEX(Table.Late,ROW()), "Yes"), INDEX(Table.BasePrice,ROW()) +INDEX(Table.LateFee,ROW()), INDEX(Table.BasePrice,ROW()))

Forgive me if I have some unmatched parenthesis in there, hope it works for you!

0 0
replied on June 2, 2021

Thanks a bunch! It worked :)

 

Additionally is there a way to add another variable to the sum? 

Some of the application types quality for a late fee (if it applies), but other application types qualify for a complex application and would have additional fees. These would never overlap, but I'm wondering if there is a possibility to get them in the same formula as they would be added across the board. 

 

Essentially, is there anyway to do both the two in the calculation?

When Late=True, than Price = Base Price + Late Fee

When Complex=True, than Price = Base Price + Complex Fee

When Late=False, than Price = Base Price 

When Complex=False, than Price = Base Price

additionally: 

When Late OR Complex=Blank, than Price = Base Price

 

0 0
replied on June 2, 2021

The additional logic is just going to make the final expression much more complicated and difficult to read, but yes it's very much possible. It's basically more of the same as above, using the IF, OR, & AND logical operators to encapsulate the logic. 

Check out the documentation below for more information:

https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/#../Subsystems/Forms/Content/FieldCalculations.htm

I haven't actually tried to write such a complicated calculation before, and I can already see this being a huge pain to write and test. I would recommend that you look into using JavaScript via the jQuery plugin to facilitate this calculation for you. It will make dealing with the logic driving the calculation much easier.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.