calculation not committed on advance to new record

327
2
05-13-2022 12:11 PM
APecharich
New Contributor II

We are running a calculated field in a S123 form that trims the value from a text field. The text field is actually being populated using wedge software to scan a RFID number. Since the value we want stored is only the last 14 characters of the RFID we use a calculate field (substr(${pitnumber_raw},-14)) to get the value to be stored in the database. I am using version 3.14.255 of the field app running on a Windows 10 laptop. We have noticed a few behaviors in form navigation that result in the calculate function not running. When the RFID is populated in the text field the focus remains in that field unless you press enter or tab. If users forget this step the calculate function will not run and we don't get the stored value, even if the user moves on to a new record in the form (we are using nested repeats). We cannot make either field required because not all records will have a RFID value (e.g., not all fish have a RFID tag). 

Is there a way to force the calculation to run before the user can create a new record in the repeat? Also - it would be ideal if the focus on the form would advance from the text field once it is populated with the RFID. 

Tags (2)
0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

 I think this may be the same one that got me today.  The calc wont fire until after the field loses focus.  So for me a user entered a number then hit the + on the repeat.  Because they never "left" the field the calc based on that field does not fire.  Just like when you type in an email on a web form.  It does not check for a valid email until to leave the field such as tab to another field.

For my form we change to the number appearance.  That will commit the change since you hit the little enter field.  I would test your form by tapping out to some other field after you scan and see if that works.  If it does I am not sure how to fix actually in your case.  Maybe you can think of it.  Or maybe 123 team has an idea.  One idea is the new calculation modes but not sure that would do it.

Give this a shot and see.

0 Kudos
APecharich
New Contributor II

Thank you for your thoughts. Unfortunately I cannot change the appearance of the field. It needs to be text to accept the RFID number using the wedge software. We do see that changing the focus, by selecting another field, pressing enter, or pressing tab will commit the entry and the calculation will run. I am asking to see if there is a way to "force" the text field to shift focus once it is no longer blank.