Jump 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.

Featured Replies

First post so if this doesn't make sense, please go easy!

I use FP v6 to run golf tournaments. Players give their exact handicap to one decimal point which is entered in a field. A second calculation field using the round function then converts this to their playing handicap. The problem is with the plus handicap players which I have to enter as minus figures e.g plus 1.3 is entered as -1.3 for other calculations to be correct. However, golf is peculiar in that it rounds plus handicaps (entered as minus) the opposite way to FP. This is only the case if the exact handicap is plus 0.5, 1.5 or 2.5. FP rounds these up to -1, -2 and -3 respectively but the rules of golf handicapping mean that they should round to 0, -1 and -2 respectively.

I have tried to write an If..Else type script in the File definitions option box without success. confused.gif

Any suggestions gratefully received.

Steveob

Try using the int() function. Int will drop the decimal, so in your example the following would happen:

int(0.5) would result in 0

int(1.5) would result in 1

int(2.5) would result in 2

You could then convert these numbers to negatives for your other calcs. Hope this helps, best of luck in your tournaments.

Adam

  • Author

Thanks for the reply. Unfortunately, there are 0.5s as well as -0.5s in the handicaps, so using int causes problems with the ordinary 0.5s which should round up to 1 rather than down to 0.

Have tried using Case but again no success. At the moment changing them manually, if I remember!

Any other suggestions most welcome.

Steveob

Maybe try this route. Make your handicaps field a text type field, the one you enter into. Then, create the following calculation and set type result as number:

Case(PatternCount(textField , "s" ) > 0, Round(TextToNum(textField),0), Int(TextToNum(textField)))

What's happening, is even though the numeric field is displaying 0.5s, it's only being read as 0.5. So, make it a text, then in the calc, use the texttonum() function to turn the text into a number format. Then, it should work.

Hope this one works!

Adam

  • Author

Thanks again for the reply aklodner. Think my lazy English may have mislead you. The "-0.5s" is just a plural, i.e. more than one player with a handicap of -0.5, the "s" is not entered anywhere in a field.

Trying to put this problem in a different way, the round function deals with every number between -3.0 and 12.0 (our highest handicap) except -0.5, -1.5 and -2.5. What I need is a a way of isolating those three numbers so that they round to 0.0, -1.0 and -2.0 and every other number "rounds" in the normal way.

I would have thought that an If..Else script should work but despite many attempts and variations, my three exceptions seem to round to 1!!!!!!

Yeah, if you only have a few conditions that differ from a default int or round conversion, then IF or CASE would be your best bet. Try writing it again, and posting the specific code and folks will most likely go out of the way here to show you what you are missing... laugh.gif

May be B)

Choose(handicap<3,Round(handicap, 2),

Choose(Abs(handicap),0,-1,-2))

Never played Golf though, so you'd rather put some real data to see what the rules are smile.gif

  • Author

Thanks for the replies everyone. Think I have cracked it after much trial and error and following the suggestions for IF and CASE.

No luck with IF but have entered the following in Define Fields/Options

"Case (EXACT HANDICAP= -2.5, "-2", EXACT HANDICAP= -1.5, "-1", EXACT HANDICAP= -0.5, "0", Round(EXACT HANDICAP, 0))

Have checked this against previous data in a copy of the dbase and all seems to be OK. would be grateful if any gurus out there could give their opinion!!!!

Your former examples definitely didn't helped clearing this issue.

Just my 2 cents :

handicap+ Choose(handicap<0 and Mod(handicap,1),Round(handicap,0)-handicap,.5)

or

Mod(handicap,1)+handicap*Sign(handicap)

if all your inputs goes from .5 to .5 from -3 to 12

Create an account or sign in to comment

Important Information

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

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.