Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6999 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a calculation field that has this calculation on it.

(At0 +

At1 +

At2 +

At3 +

At4 +

At5 +

At6 +

At7 +

At8 +

At9 +

At10 +

At11 +

At12 +

At13 +

At14 +

At15 +

At16) / Length

The problem is, is that I frequently get decimals with this function. Is there a way to add a round function to this? Every time I try FileMaker tells me that its looking for a field not a calculation. Any help you can give is much appreciated.

Posted

Is Length a field? Or a number? It shouldn't be a field name because it's also a function. But try this:

Round (

( At0 +

At1 +

At2 +

At3 ) / number ) ; 0 )

You didn't specify your rounding desires - there are many variations of the desired result. Without more information, I can't be more exact but I hope this gets you moving in the right direction. If not let us know and we'll help you further.

I must say, Heathbo, that having that many fields to add together certainly indicates improper relational structure. (signed) Soren :wink2:

... for LaRetta ... :laugh2:

Posted

I must say, Heathbo, that having that many fields to add together certainly indicates improper relational structure. (signed) Soren :wink2:

... for LaRetta ... :laugh2:

All of those fields are different stages of the same record. Not all the stages have a value. Length is a count of how many stages have a value. Based on this, my purpose of this calculation was to create an average value of all the stages with values.

Posted

I repeat the above just as firmly - this same math and testing can be handled in records and would work much better!

But hey ... it was rude of Soren to jump into our thread anyway!! :giggle:

Soren knows I'm kidding him ... but I'm serious about totally agreeing this time ... You will be repeatedly writing these types of long calcs (which need to be modified any time you add a field) instead of letting FM do what it does best ... sum related, count, perform math, and provide statistics. I'd even rather see you go to Repeaters here than fields. And expect to write a thousand more calcs just like this - and don't expect to EVER produce a logical report grouping by stage.

Hey. I say this because I like you. If I didn't give a rip, I wouldn't even post, right?

LaRetta

Posted

All of those fields are different stages of the same record. Not all the stages have a value. Length is a count of how many stages have a value. Based on this, my purpose of this calculation was to create an average value of all the stages with values.

Records. They would be records in a Stage table with a foreign key of the main record and a serial field and a text field for the TYPE of stage (or level) and a VALUE field (number). Test the relationship for existance of stage record with If ( not IsEmpty(serial) . Then count them with, ummm, yep ... Count(Stage::Serial) and possibly Sum(Stage::Value) ... Apply your math like Average = Div( value ; count) ... and providing value lists for popups or filtered portals by Stage::Type and generating nifty instant reports grouping any-which-way-but-loose but particularly to evaluate multiple main records' various stages against each other. Reporting from your Stage table allows summaries to carry the weight and decrease the aggregate needs.

Possibilities are endless. Flexibility is maximized. Math is simple. Your sanity is saved and you'll have a lot more time for other things than typing the field names repeatedly or attempting to find convoluted calculations to solve problems that shouldn't exist to begin with. And I didn't even have to THINK about that one! I just gave you an entire structure in the time it took you just to TYPE your fields for this ONE calculation ... :wink2:

LaRetta

This topic is 6999 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.