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

Question

Question

Form Row Calculation

asked on January 25, 2024

I'm looking to have a form calculate a cost based on a service and the number of hours requested. If the service Sign Language Interpreter for Adults is requested AND the total duration is > 2 hours, the rate per hour should double. I can get the calculation to work based on this formula, but when I add a row, the Service Rate per Hour is not calculating correctly. 

 

Here is my form calculation. I have tried adding an index, but it doesn't seem to work. 

=IF(AND(Collection.Service="Sign Language Interpreter for Adults", Collection.Number_of_Hours__Duration_>2), Product(Collection.Service_Rate,2), Collection.Service_Rate)
 

 

Without adding a row = Calculation is correct

 

When Adding a Row

0 0

Answer

SELECTED ANSWER
replied on January 25, 2024 Show version history

Each time you reference the current row's value of a column, you'd need to change the formula to get that value. Using one of your examples:

Instead of:

Collection.Service="Sign Language Interpreter for Adults"

Use:

INDEX(Collection.Service,ROW())="Sign Language Interpreter for Adults"

I also believe you might be incorrectly using the equals sign here. The `EQ` formula should be used instead.

EQ(INDEX(Collection.Service,ROW()),"Sign Language Interpreter for Adults")

Similarly, I believe you incorrectly used a `>` when it should be the `GT` formula.

GT(INDEX(Collection.Number_of_Hours__Duration_,ROW()),2)

This leaves us with what I think would be the correct formula here:

=IF(AND(EQ(INDEX(Collection.Service,ROW()),"Sign Language Interpreter for Adults"), GT(INDEX(Collection.Number_of_Hours__Duration_,ROW()),2)), Product(INDEX(Collection.Service_Rate,ROW()),2), INDEX(Collection.Service_Rate,ROW()))

I suggest referencing Formulas in Laserfiche Forms whenever you are trying to write these.

3 0

Replies

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

Sign in to reply to this post.