February 17, 201312 yr 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.
February 18, 201312 yr 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]
February 18, 201312 yr 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.
February 18, 201312 yr 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.
February 18, 201312 yr 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