April 21, 20169 yr Hello, I am gonna describe a scenario where total automation needed using only barcode scan, please bear with me: I am creating operator timesheet layout for product lifecycle in list-view. Each operator has a list of unique barcodes(printed sheet) for each production function. Every activity(function) of print production is assigned code (barcode) that represents function type as well as operator name: For eg. if John is working on new plates function for Press he'd scan barcode 301-1 but if Marc is working on the same function , he'd scan 301-2 , Now '301' represents new plates function and number after hyphen(-) represents operator. In John's case 1 and Marc 2. So, on the interface(list view of functions) , when an operator scans barcode of function it will set time-in field value and name of operator in their fields based on calculation from code. I don't want STOP button for each function to set value of time-out (because it requires user interaction), rather, I want it automated. I am looking for some sort of script trigger that runs on every new code scan and search for last record with similar operator name and set time-out value as current time in that record and set the same value as time-in for new function record. Thank you Edited April 21, 20169 yr by dav1089
April 22, 20169 yr **I'm writing this without any testing, so please treat this as a suggestion or push in the right direction rather than final instructions. This is an old, old, old FM trick - To retrieve the last created record, you can create a self-join relationship with reverse-chronology sort order. The relationship will match on the operator ID. If you were to set a field using the time-out value through that relationship, it'll pull the value you need. If the operators are scanning these multiple times per day and the FMP session doesn't shut down often or at all, then you can perhaps capture the time-out for each operator as they submit them, and set a global variable. Then just refer to this G.V. as needed.
April 25, 20169 yr Author Hi @BrentHedden , I created script trigger onObjectSave for ID field but can't seem to be working : So I created self-join relationship with operator ID as match field , but how to do Go to Record/Request to find previous record with duplicate ID .. (Do I do find record)? I also created global to store entered operator ID and compare against self-joined occurance match field I have done script trigger in past to find duplicate field records but , this time it is little complicated , I am also assigning value to another field.. and coming back to new record Please help me Thank you
April 25, 20169 yr On 04/21/2016 at 10:48 PM, dav1089 said: search for last record with similar operator name and set time-out value as current time in that record I am puzzled why you need to do this duplication of data. If every new record starts a new time period and ends the time period of a previous record with a matching value, then the end time can be got directly from the subsequent record using a relationship.
April 25, 20169 yr Author 3 minutes ago, comment said: If every new record starts a new time period and ends the time period of a previous record with a matching value, then the end time can be got directly from the subsequent record using a relationship. Sorry, how do I do it exactly?
April 25, 20169 yr Define a self-join relationship along the lines of: YourTable::OperatorID = YourTable 2::OperatorID AND YourTable::SerialID < YourTable 2::SerialID Place the start time field from YourTable 2 on your layout - it will show the end time of the current record.
April 25, 20169 yr 1 hour ago, comment said: Define a self-join relationship along the lines of: YourTable::OperatorID = YourTable 2::OperatorID ANDYourTable::SerialID < YourTable 2::SerialID Place the start time field from YourTable 2 on your layout - it will show the end time of the current record. This is one of the advantages of using a serial number over the new Get ( UUID ).
April 25, 20169 yr 23 minutes ago, LaRetta said: This is one of the advantages of using a serial number over the new Get ( UUID ). True. Although if the start times are timestamps, they could be used instead.
April 25, 20169 yr I almost mentioned using the creation timestamp. Particularly if the records aren't entered in start time order.
April 27, 20169 yr On April 25, 2016 at 4:13 PM, comment said: Define a self-join relationship along the lines of: YourTable::OperatorID = YourTable 2::OperatorID AND YourTable::SerialID < YourTable 2::SerialID Place the start time field from YourTable 2 on your layout - it will show the end time of the current record. Yes, this is what I was trying to describe in my previous post. Thanks to Comment for making this clearer.
Create an account or sign in to comment