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.

Modifying data input during a scripted find

Featured Replies

I arrived at a solution that is working now.

The problem I was trying to solve:

I have a field containing a bar code number, and want to have a find executed against the data, but if the first two characters of the barcode were "AB", to strip those off before executing the find.

The solution:

Use a custom dialog box with user input to scan the barcode; store the results in a global field; run an If statement, and if the first two characters are "AB", set a variable to the value minus the left two characters; perform a find using that variable.

---------

Following is what I tried before the working version. I'm leaving it here mainly because I'm still trying to understand more (in my general FileMaker knowledge) about PROBLEMs 1 & 2 (#3 has been solved by using the custom dialog with user input, etc.). But since I have a working solution, only have a look if interested. thanks

I have a field containing a bar code number, and a button that runs a script to perform a find on that field, where the user scans the bar code, and the scanner returns the number plus a carriage return (I have the scanner programmed that way) to  execute the find. When there is a record with a bar code label whose number below the bar code itself matches (e.g., "20154673"), the following script works just fine.

Enter Find Mode [ Pause: Off ]

Go to Field [ Select/Perform ; hardware::id_num_org ]

# At this point, the bar code is scanned, and the CR
# triggers the find.

However there are some barcodes begin with "AB" which are not to be used in the records (business rules). When using "Enter Find Mode [Pause: Off ], "Go to Field [ Select/Perform ... " is then executed before the barcode is entered; if pause is On, the user has to manually select the field to enter in (unless there was an active record, and the target field was active) -PROBLEM 1.

If a record is not found due to the leading "AB", the "No records match this criteria" dialog is suppressed (as I want with error capture on), but the error code returns "0", not "401"—UNLESS I use "Perform Find [ Restore ]" with the criteria being data beginning with "AB", but of course the data being searched on is derived from the barcode scan. -PROBLEM 2.

(Note: I simplified debugging of the error code by temporarily commenting out the If structure, and placing a custom dialog at the end of the script, using "Get Get ( LastError )" ) .

Once I can (hopefully) get into the If structure OK, how can I modify the data that was input during the search? I have the code for "Set Field" (or similar) worked out, but don't know how to capture the input data into a variable, or what have you. -PROBLEM 3.

Following are the basics of the script so far:

Set Error Capture [ On ]

Enter Find Mode [ Pause: Off ]

Go to Field [ Select/Perform ; hardware::id_num_org ]

If [ Get ( LastError ) = 401 ]

  # I only want to run the steps inside the following
  # If statement if the scan begins with "AB";
  # not if there simply is no record for the barcode.

  If [ Left ( hardware::id_num_org ; 2 ) = "AB"
     Modify Last Find

     # I think in order to not require the user to
     # rescan if we get to this If statement, that I may
     # need to capture the scanned input into a variable.
     # That is yet another thing to work out.

     Set Field [ hardware::id_num_org ; Right ( hardware::id_num_org ; Length ( hardware::id_num_org ) - 2 ) ]

  End If

End If

Set Error Capture [ Off ]

I tried using Perform Find [ ] , but didn't see a way to pass the scanned barcode using criteria for "Specify Find Requests".

Edited by ken_s2007
I found a solution.

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.