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.

Enter '+' sign to add .5 to contents - possible?

Featured Replies

Background - this database is a dressage show solution - among other things, it handles scoring of dressage tests. Dressage tests are patterns that horse and riders perform where they are scored on their movements. Some movements have coefficients where the score is doubled. All score fields have a corresponding calculated field next to them to hold the final score for that movement.

 

My scorers enter the scores for each movement on the appropriate layout. I have already got a script trigger on each score that mimics a the way calculators work by setting a variable with the entered score and setting the next field with that score when the user hits enter or tab. This script trigger uses a custom function - KeystrokeAsCalculator which picks up the use of the enter or tab field to set off the trigger. This is all good.

 

Recently, in dressage, the powers that be decided that .5 could be added to each score. Previously, the only scores available were whole numbers 1 - 10. Now, scores available are 0, .5, 1, 1.5, 2, 2.5 etc up to 10. This is not a problem with my existing solution in that the scorers can enter the .5 and all works properly.

 

But, the scorers want to go faster (hit fewer keys) - so they have asked if they could hit the + key and have that add .5 to the score they just entered.

 

I wrote a similar custom function to KeystrokeAsCalculator -- KeystrokeAsPlus which says:  

 

Let(

keyCode = Code ( Get ( TriggerKeystroke ) );
 
( keyCode = 43) 
 
)
 
ok - this does pick up the + key.
 
But, I have not been able to add to my existing script trigger to have the score read 5.5 when the user enters 5+. This is my current attempt:
 
Set Variable ($score; Value (Get(Active Field Contents))
If [KeystrokeAsPlus]
   Set Variable ($field; Value("Current Classes::" & Get(ActiveFieldName))
   Set Field by Name [$field; $score + .5]
End If
If [KeystrokeAsCalculator]
  Set Variable ($score; Value (Get(Active Field Contents))
  Go To Next Field
  Set Field [$score]
  Exit script [Result:: "false"]
End If
 
The fields in question are currently set to be number fields. I have tried setting them as text fields. Entering the + does give me the result of the score plus .5 in the calculated field next to the active field that is accepting the input (as the score is entered), but the active field shows only a +   -- and so, upon hitting the enter or tab key, all reverts to 0.
 
Thanks for any advice!!!
 
Martie
 
post-103345-0-35460100-1425828953_thumb.
 
 

can't you just click a button instead?

Just use a button that runs a script.  Triggers are for handling specific types of events

I have already got a script trigger on each score that mimics a the way calculators work by setting a variable with the entered score and setting the next field with that score when the user hits enter or tab. This script trigger uses a custom function - KeystrokeAsCalculator which picks up the use of the enter or tab field to set off the trigger.

I got a bit confused by your description. How does a keystroke come into play here? If your users hit Enter or Tab when they are done, then you should set the entry field (presumably a global Text field) to Go to next object using [x] Tab [x] Return [x] Enter (in the Inspector), and run the script OnObjectExit. That would be much easier (as well as more efficient) then listening for individual keystrokes.

 

As for reading the entered score, that too should be very simple (unless I am missing something), for example:

If [ not IsEmpty ( YourTable::gEntry ) ]
 Set Field [ YourTable::Score; YourTable::Score + GetAsNumber ( YourTable::gEntry ) + Case ( PatternCount ( YourTable::gEntry ; "+" ) ; .5 ) ]
 Clear [  ] [ Select ]
 Exit Script [ Result: False ]
End If

You'd probably want to add some sort of checking mechanism to prevent obvious typos from being accepted. Personally, I would prefer to use another field (or records in another table) as a log of all the entries made, in case there's need to go back and correct an inadvertent entry.

Here's another approach you may want to consider:

 

ScoringLoop.fp7.zip

  • Author

thank you all  very much for these thoughts!

 

I do think I could use OnObjectExit rather than listening for a keystroke, -- I will play with that and with the idea of a global field to temporarily hold the value while it's being entered.

 

thank you very much!

 

Martie

 

ps - I don't want to use a button because the scorers want to keep their fingers on their keypad, they don't want to move back and forth from the keypad to the mouse.

they don't have to, they can tab to a button and hit space to run it.

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.