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

Question

Question

Laserfiche Forms Calculating Indexes in tables

asked on August 1, 2019 Show version history

Hi,  When using a subtraction formula to calculate mileage I keep getting this error below, seems like it doesn't like blank indexes, however the calculation still comes out correct, how can I get rid of the error?

Here's the Formula: =SUB(INDEX(Expenses.ODO__to,ROW()),INDEX(Expenses.ODO__from,ROW()))

 

 

0 0

Replies

replied on August 1, 2019 Show version history

You can wrap it in an IF function. IF(INDEX(Table.Column,ROW())<>"",INDEX(Table.Column,ROW()),0)

IF index is not empty, use index value

Else use 0

The problem is that some math functions for OpenFormula don't like empty values, whereas others aren't affected.

0 0
replied on August 1, 2019

Hi Jason,

 I think I've tried something like that and the Number of Miles field just shows 0 with no calculations:

=IF(INDEX(Expenses.ODO__to,ROW())<>"",INDEX(Expenses.ODO__from<>"",ROW()),0)

 

0 0
replied on August 1, 2019 Show version history

The second part of your formula is incorrect.

=IF(INDEX(Expenses.ODO__to,ROW())<>"",INDEX(Expenses.ODO__from<>"",ROW()),0)

The extra <>"" shouldn't be inside index function.

=IF(INDEX(Expenses.ODO__to,ROW())<>"",INDEX(Expenses.ODO__from,ROW()),0)

0 0
replied on August 1, 2019

sorry just fixed it, still came out blank.

0 0
replied on August 1, 2019 Show version history

Blank or 0?

What happens if you just use

=INDEX(Expenses.ODO__from,ROW())

0 0
replied on August 1, 2019 Show version history

ok it works now. I had a comma "," at the end of the statement.  that's why it was blank instead of a "0". but... the calculation is off:

 

suppose to be 250-200 = 50 miles

then 50 * .58 = 29.00

 

0 0
replied on August 1, 2019 Show version history

No problem. An alternative to using two IF calculations is to wrap your entire SUB function in the IF then use an AND for the condition.

For Example,

=IF(AND(INDEX(table.column1,ROW())<>"",INDEX(table.column2,ROW())<>""),SUB(),0)

Here you get

IF Column1 AND Column2 are not empty THEN SUB

ELSE 0

0 0
replied on August 1, 2019

let me try that.... i'll get back to you if it doesn't work.

0 0
replied on August 1, 2019

ok.. a lot better.  calculation works with no errors now.  Thank you!

0 0
replied on August 1, 2019

no problem!

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

Sign in to reply to this post.