May 31, 200223 yr I want to put a button on my Purchase order form to create a duplicate record. My form is related to another file for line items, which I input through a portal. The problem is when I duplicate a record none of the portal items show up. Is it possible for FM to duplicate the contents of a portal too, or do I have to avoid using the portals?
May 31, 200223 yr You need to duplicate both the master record and the related line items records ... Perfectly doable, a bit convolute ... the script would look like: Set field (gID, OrderID) //Note: this is the "original" OrderID, OrderID is a unique serial number,gID is a global field Duplicate master record Go to related record (Show, Relationship to line items linking gID::OrderID) //This selects the line items belonging to the "original" OrderID Set field (gID, OrderID) //Note: this is the "duplicate" OrderID Perform external script in Line Items, see below Go to record [Last] Loop Duplicate record Set field (OrderID, Relationship to Orders::gID) //This steps puts the "duplicate" OrderID in the duplicate line item record Omit Record Omit Record Exit Loop If (Status Current Found Count < 1) End Loop
May 31, 200223 yr Author Hey thanks for the help. A little daunting seeing as I've never actually done a script, but I tried it out. I think I got it except I got hung up on one action: Exit Loop If (Status Current Found Count < 1) FM would not allow me to type it this way "not recognized as a flag" or something like that. Maybe I should read a book.
May 31, 200223 yr Sorry, the sintax was approximate .... the correct one is: Status (CurrentFoundCount)<1
May 31, 200223 yr Author Thanks again. It almost worked this time. It copied everything 3 times. I guess I'm having a problem with relationships (with my database that is). Right now I have a relationship between PO.fp5 (the master file) and line items.fp5 (related file) with the two joined on a field called PO Number (Auto-serial). Do I have to create some more relationships to the new global field created in PO.fp5?
June 1, 200223 yr You've just to make a new relationship between the global field and the PONumber in LineItems ... check the script in LineItems and see if you're omitting both the original record and its duplicate ...
Create an account or sign in to comment