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.

Clearing Field Contents

Featured Replies

Hi Board,

 

My latest UI is for barcode scanning.

 

Firstly, the user scans their barcode and a script triggers and sends them to the next field when the input has reached 32 characters.

 

In the second field, it automatically puts a carriage return. When i scan my second barcode, the script craps out because it needs the field to be empty.

 

I have tried using GoToField commands, Clear commands, Cut, Select, commands, everything i can think of and nothing gets rid of the carriage return in this field, nothing except the backspace key on the keyboard.

 

How do I stop the carriage return showing up or delete it once it's there?

I need the barcode reader to put a carriage return on the end of the scan or the scripting doesn't work. There are other Layouts that require this scanner and they need a carriage return also.

 

Thanks for any help or guidance you can give me!

 

H

  • Author

Just tried a Find/Replace for a carriage return, replace with "" OnObjectEnter but no dice!

 

This is seriously frustrating now!

Not sure I really understand your workflow, but shouldn't a simple

Set Field [ YourTable::field2 ; "" ]

do the trick?

  • Author

Nope.....

 

I am testing now - so i've used a 'SetField' (MyField; "Hi")

 

and it sets the field as 'Hi'.

 

But, if i then use a GoToField command, it puts the carriage return there. I have tried 'SelectOnEnter' and 'Clear' commands but nothing is working!!!

Firstly, the user scans their barcode and a script triggers and sends them to the next field when the input has reached 32 characters.

 

In the second field, it automatically puts a carriage return.

 

It sounds like your scanner is programmed to output a CR at the end of a scan? If so, why don't you use that to switch to the other field, instead of counting the characters?

 

--

For even better results, you might want to reprogram the scanner to output a tab instead of CR.

Edited by comment

  • Author

WorkFlow:

 

1. Operator scans their Personal Barcode

2. Script Checks it's 32 digits, checks it's in a table of Staff and then sets that as a Var.

3. Script moves to second Field.

4. Operator scans Production Order barcode.

5. Script presents Operator with a list of jobs for said Production Order for them to click on.

6. ... other script steps that print labels and set data of variables etc etc.

 

So, the first Personal Barcode works great. But this ******* carriage return is excruciating!


I want to make sure they're scanning the correct barcode, rather than a different barcode or one that is on the worksurface, an accidental scan.

Taking the CR off the barcode reader breaks all the other scripts i've got.

  • Author

Is there a way to stop CR's being inputted into a field?


I'm just not sure where the CR is coming from in the first place.

 

If I remove the 'GoToField' part of my script, it doesn't put a CR in the first field. It just sits there at the end of the 32 char. If you then physically click onto the field, it doesn't put the CR there.

 

If I set the field to be "Hi", it puts 'Hi' there. But, if i set it to "Hi" and then use the 'GoToField' command, it puts the CR there!

Is there a way to stop CR's being inputted into a field?

 

Yes, there is - but it would be much easier to set the first field (in Layout mode) to 'Go to next object using: [x] Return'. Than you won't need your script to go to the other field - it will happen automatically when the first scan is done (provided the second field is the next object in the layout's tab order).

  • Author

OK, thank you.

 

Is GoToNextObject like GoToObject? I don't have 'next' version...

 

I have a field trigger that automatically goes to the next field when the scanned input reaches 32 char. That's an 'OnObjectModify' trigger...

 

If Length(Field_For_Input)=32

Go to (Next_Field_For_Input)

 

... type of thing.

Is GoToNextObject like GoToObject? I don't have 'next' version...

 

It's not a script step - it's a setting you apply to the field in Layout mode, using the Inspector.

  • Author

Got it. Right, that works but requires the user to hit the Return key - it's not picking up the CR from the scanner. And the user also has to then click into the field.


Why does the 'Clear Field' not work?  Does it disregard CR's?


When i navigate into that field, either by clicking or tabbing, it selects the entire contents. I can then hit delete and the contents clear - why can't i script that????

Right, that works but requires the user to hit the Return key - it's not picking up the CR from the scanner.

 

Well, then either the scanner is not outputting a CR or you have something (a triggered script?) that interferes with the process.

  • Author

OK, thank you. I'm going to re-write this script from the beginning with no actions or triggers anywhere.

 

The first thing I've got wrong is that my 'Length' script doesn't work.

Script is set to run:

OnObjectKeystroke

 

If [Length (Scanned_Input_Field) = 32]

Set Variable $$Operatorl; Scanned_Operator_Input_Field]

Go to Field [select/perform; Scanned_WO_Input_Field]

End If

 

So, in my mind, this is the best way to have a barcode reader scan into a field, each time a char goes into that field, the script runs....

 

But, this above doesn't work. When 32 chars are put into that field, it does nothing, it needs a 33rd char to be entered before it will move on.

 

If I set it to '=31' it puts the 32nd character into the second 'Scanned_WO_Input_Field'....

  • Author

Strangerer and strangerer...

 

My script for scanning:

 

If [Length (Scanned_Input_Field) >1]

Beep

 

Produces a Beep when 32 char scanned into field.

 

If [Length (Scanned_Input_Field) >30]

Beep

 

produces a beep when 32 char scanned into a field

 

If [Length (Scanned_Input_Field) >31]

Beep

 

does not produce a beep when 32 char scanned into the field....


Same as '=32' rather than 'Greater Than' calcs..........

 

It beeps with 1 through 31, but at 32, it stops beeping. Even though the field contents is 32char.

  • Author

ARRGHHHhhhh!

Script is set to run:

OnObjectKeystroke

 

If [Length (Scanned_Input_Field) = 32]

Set Variable $$Operatorl; Scanned_Operator_Input_Field]

Go to Field [select/perform; Scanned_WO_Input_Field]

End If

 

So, in my mind, this is the best way to have a barcode reader scan into a field, each time a char goes into that field, the script runs....

 

But, this above doesn't work. When 32 chars are put into that field, it does nothing, it needs a 33rd char to be entered before it will move on.

 

The point you are missing here is that a script triggered OnObjectKeystroke is executed before the triggering event. Thus when a character is entered, the script runs -  but the field does not yet contain the triggering character. This will be entered only after the script has exited (provided the script did not cancel the triggering event by exiting with a false result).

 

Note also that if your script moves to another field and does not cancel the triggering keystroke, the character will be inserted into the currently active field - which is not the original field.

 

 

 

So, in my mind, this is the best way to have a barcode reader scan into a field, each time a char goes into that field, the script runs....

 

IMHO, you are wrong about that. I believe it would be best to let the scanner emulate a human user - i.e. enter some characters, then press tab/return/enter to move on. It would certainly be simpler.

  • Author

Right, so it's not evaluating the last digit in the field, until it's been added to - or moved away from, or something....

 

Odd behaivour i obviously don't understand how this Length function is working...

 

If i scan in the barcode and then hit the right arrow key, the script flows correctly. But if I make the script only progress when it reaches 31, instead of 32 char, then it puts the 32nd char into the next field.

  • Author

Hi Comment, Thank you for explaining it.

 

I have removed the Trigger Script, set the field to Move to Next Objext Using Return, then set the barcode scanner to put a return after the scan.

 

It moves to the next field and then puts a carriage return into the new field! Like it's not using that keystroke just as an action, but as an input, as well.

 

Using 'Tab' to move, and removing the CR from the scanner, using a keyboard to enter the Tab, also puts a tab into the second field.

It sounds like the trigger is still there.  Can you reproduce this problem in a brand new file, that has nothing but two fields?

  • Author

Right, i've built another script that clears out the second field after it's made active.

 

So, teh cursor goes to the second field with the 'Enter to next object' bit you suggested, then on Enter, it selects and clears the entire field.

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.