Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Getting Max Numbers Calc

Featured Replies

I have 7 fields, these fields can have numbers between 1 and 20. all numbers are two characters long (01, 02, 03..ext).

What I want, is only the biggest 5 numbers.

Is there a way to do this? The only way I can think of is to do something like this.


Let([

//Get the biggest number

Max = Max ( field1, field2, field3, field4, field5, field6, field7);

//Get the second biggest Number



Max2 = Case(

Max = field1; Max ( field2, field3, field4, field5, field6, field7);

Max = field2; Max ( field1, field3, field4, field5, field6, field7);

Max = field3; Max ( field1, field2, field4, field5, field6, field7);

Max = field4; Max ( field2, field3, field1, field5, field6, field7);

Max = field5; Max ( field2, field3, field4, field1, field6, field7);

Max = field6; Max ( field2, field3, field4, field5, field1, field7);

Max = field7; Max ( field2, field3, field4, field5, field6, field1));



//Get the Third Biggest Number

Max3 = Case(

Max = field1 and Max2 = field2; Max( field3, field4, field5, field6, field7);

Max = field1 and Max2 = field3; Max(field2, field4, field5, field6, field7);



and so on.



surely there is an easier way to do this.

By the time I get to the fifth number my code is going to be huge, anyone got any advice.

Sounds like a candidate for a CF. But what's your rule for dealing with ties? (does 05 05 05 count as one number or three?)

Naugty ...naugty, unless it's keyfields we're talking about. But if it ain't take a look at this template:

http://www.fmforums.com/forum/attachment.php?attid/5451/

...from this thread:

http://www.fmforums.com/forum/showtopic.php?tid/171364/post/182834/hl//#182834

But if you're in the clear with good conscience, could this be used:

http://www.briandunning.com/cf/26

...and leading zero's is just what fits the bill, although they aren't the standard setup for autoID's.... :)

--sd

  • Author

Ender:

05, 05, 05

would be three numbers, and if I coded the calc/cf the way I show above, it would actually still return me three numbers.

Thanks Soren, I'll play around with Brians Bubble function and see if it will do what I'm wanting.

Don't give Brian the full credit, he's just hosting this function that Greg Lane from The Moyer Group, has made!!!!

--sd

There are several ways to do this. Five out of seven is not that many, but I think the "brute force" approach you have tried could be more efficient if one concentrated on finding the lowest two, and scratching them off the list.

Of course, the best way is to offload the values to a related file. Then you can use a value list, or GetNthRecord() to get any segment you need.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.