1 Reply Latest reply on May 16, 2013 8:21 AM by TSGal

    Search field A and replace field B



      Search field A and replace field B


           Good evening everyone!

           I'm working on an assets datablase for an IT firm that moves around a large quantity of computer devices (switches, routers, modems, etc.).  Every device has a unique barcode asset ID sticker on it.

           I'm trying to design an iPhone view that will allow a technician to scan the barcode (using the CNS Barcode app which is very VERY cool),  (or enter the ID number) in a "search" field and change the location of the device.  The barcode portion of the view is under control; I have that funtionality working perfectly.

           Think FedEx or UPS tracking.  If the device starts at office A, and then moves into truck 1, and then ends up at office B, the "location" field should be updated along the way, and the iPhone weilding truck driver should be able to scan the barcode on each device and change it's location.

           I'm stumped on how to write a script to "search" for the asset ID and then change the "Location" field.

           Any help would be much appreciated!!!




        • 1. Re: Search field A and replace field B

               Evan Stein:

               Thank you for your post.

               If you just want to update the location, then once you scan the object, you should look up the item to find the record and change the Location.  For example, if the item is being scanned into a global field "g_scan", then your scripit may be something like:

               Set Variable [ $BarCode ; Value: <table name>::g_scan ]
               Go to Layout [ "Assets" (Assets) ]
               Enter Find Mode []
               Set Field [ Assets::AssetsID ; $BarCode ]
               Perform Find []
               Set Field [ Assets::Location ; Location ( 50 ; 5 ) ]


               In essence, we take the value scanned in and store it to a variable ($BarCode).  The script then switches to the layout that contains your assets where we enter find mode and search for the $BarCode value just scanned.  When found, we update the Location field to the new location.

               However, when I think of FedEx or UPS, I want an audit trail of where the item has been in case it gets lost.  Therefore, I would create a second table called Locations that links back to the Assets (via AssetID).  In the Locations table, I would not only record the new location, but also the date (and possibly time).  Therefore, after the Perform Find script step above, you can switch to the Locations table/layout, add a record and update the AssetID (to link the record), Date field and Location.  For example,

               Go to Layout [ "Locations" (Locations) ]
               Set Field [ Locations::AssetID ; $BarCode ]
               Set Field [ Locations::Date ; Get ( CurrentDate ) ]
               Set Field [ Locations::Location ; Location ( 50 ; 5 ) ]

               This should give you a good starting point.  Let me know if you need clarification for any of the above steps.

               FileMaker, Inc.