Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

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.

Posted

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.

This topic is 3547 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.