6 Replies Latest reply on Apr 23, 2009 10:01 PM by davidhead

# Trouble with a calculation

### Title

Trouble with a calculation

### Post

Hi there.

I am having trouble with a calculation.

I have a drop down box that has 4 Places, pretend it is AAA, BBB, CCC and DDD

I also have a box entered for a specific time, say when a flight is to leave. All times entered are in 24 hour time, eg: 0800, 1200, 1350, 1800

My goal is to make a calculation that tells people what time they need to leave to get to one of these places (AAA, BBB, etc.) before their flight leaves, so I assume the calculation would be:

Time =

If Place = "AAA" ( FlightTime - 400; "-" ) or If Place = "BBB" ( FlightTime - 200; "-" ) and so on.   <- The "-" represents a nil time if it can't find anything in the "Place" field.

Yet it doesn't seem to be working.

Any ideas?

• ###### 1. Re: Trouble with a calculation

Case(table:: placefld = "AAA", table::flighttime - 400, table:: placefld = "BBB", table::flighttime - 200, table:: placefld = "BBB",   , table:: placefld = "CCC",   , "" )

You'll have to fill in the blanks for BBB and CCC. The last empty string, "", should return your "nil" value.

• ###### 2. Re: Trouble with a calculation

Thanks Phil, that worked :)

Also, is there a way to round the number of to the nearest whole 100?

• ###### 3. Re: Trouble with a calculation

Round(table::field/100,0) * 100 will round to the nearest 100.

• ###### 4. Re: Trouble with a calculation
Do I add that into the same calculation?
• ###### 5. Re: Trouble with a calculation
Replace "table::field" with the entire case function from the earlier post.
• ###### 6. Re: Trouble with a calculation

PhilModJunk wrote:

Round(table::field/100,0) * 100 will round to the nearest 100.

This will also work and is simpler:
Round ( table::field; -2 )
;)