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.

search/add new record based on part of text string

Featured Replies

I have an Inventory table where each item has an Asset ID - a number which either begins with HDCR or RAD. Sometimes we rent items from other vendors which we call Sub Vendors. When a user scans the barcode of a Sub Vendors' Asset (which wont be prefixed by HDCR or RAD) in to the Asset ID field in Find Mode, I want FileMaker to prompt that it isn't an item that we own, and ask if they would like to add it as a new item to the Sub Vendor table.

 

Basically, is it possible for FileMaker to reference the first part of the Asset ID to see if the item is ours or not? A typical Asset ID would be RAD10110 or HDCR56774, etc. 

How about a calculated field Ownership = 

 

Case(

Left(AssetID;3)="RAD"; "Ours";

Left(AssetID;4) = "HDCR"; "Ours";

"Not ours"

 

 and a script triggered by an OnObjectModify trigger in Ownership

 

If[Ownership = "Not Ours"]

Set Variable[$Asset_id; AssetID]

Show Custom Dialog["Subvendor Item";"Do you want to add this item to the Sub vendor table?"]

If[Get(LastMessageChoice)=1]

freeze window

go to layout["subvendors"]

New Record/Request

Set Field[AssetID; $Asset_id]

Go to Layout[Original Layout]

  • Author

beautiful. many thanks!

  • Author

question: the subvendor item typically won't already be entered in to the system, however sometimes it is. how would this script be activated should the asset_id search result in foundcount = 0? i feel a script like this should be based on the foundcount within the asset_id field. the search works like this

 

user clicks "find asset"

they scan the barcode (in to the asset_id field within the assets table)

if found - goes to record

if not found - dialogue box "0 results"

 

additionally, it would help to search both tables (both the asset table and subvendor asset table) to see if it does exist.

Your scanner output should go to a global field in assets.  Then the script flow would go something like:

 

set error capture on

if scanned input is ours

go to layout in assets table

enter find mode

set field asset id; global_input

perform find

if get(last error) = 401//error code for no records found

Prompt for new record

if get last message choice =1

new record

set field asset id; global input

End if//last message choice

end if//get last record

end if//scanned input is ours

#note that perform find will end up on desired record if it exists

if scanned input is not ours

 

go to layout in sub assets table

enter find mode

set field asset id; global_input

perform find

if get(last error) = 401//error code for no records found

Prompt for new record

if get last message choice =1

new record

set field asset id; global input

 

End if//last message choice

 

end if//get last record

end if//scanned input is not ours

 

These are not actual script steps; they only describe the flow of the script. It's too durn late to write the script.

 

  • Author

It's too durn late to write the script.

 

it most certainly is!

 

thank you for your help. i will try and implement this in the morning. cheers!

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.