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

search/add new record based on part of text string


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

Recommended Posts

Posted

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. 

Posted

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]

Posted

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.

Posted

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.

 

Posted

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!

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