Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Dupe One and Many w/ Serial Numbers

Featured Replies

Hi all,

My first post. Have already gleened much from the forums. Many thanks to all the masters.

Here's my One to Many "dilema"... shocked.gif" border="0

I have 2 dbs - "Master Item" (One) and "Component" (Many). "MI" has a unique serial number assigned to each new record. Through a script between "MI" & "C", a user increments a "component number" field by one for each new component created (this number is held in the Master Item record), creates a new record in "C" that sets the serial number from one global, and sets the new component number from another global. The two are read into "C" and the relationship is made (i.e. - P4100-1)

Here's the fun...

From "MI", I need to be able to let my users, at *only* the click of a button, duplicate the current "MI" record and related "C" records. The duplicate assigns a new serial number to the "MI" record, but how do I duplicate the related records in "C" and get my new serial number into the necessary field to make the relationship to the new Master record work?

This is all to save tremendous amounts of data entry as many items can carry duplicate information.

I'm sure there is a very simple solution to this, but just can't seem to find it yet. Many thanks in advance for any help.

Jim Mitchell

[email protected]

[ December 21, 2001: Message edited by: Jim Mitchell ]

Not sure about the whole serial number thing you have going -- it sounds like a lot of extra work. Nevertheless...

It sounds like you want to duplicate one Master record and all of its related records so that the duplicated related records now relate to the duplicate of the Master record. If so, I recommend the following steps:

2: Create a script in the Master file that:

a) shows all records,

: omits the current record (Omit Record),

c) shows the omitted record (Show Omitted),

d) copies the key field (the one used to relate the "C" file records) in the Master file,

e) performs an External Script (see step 1 below),

f) duplicates the current record and sets the key field to the new serial number.

1: Create a script in the "C" file that:

a) finds all related records (Enter Find Mode, Paste [into the key field], Perform Find),

??? duplicates all found records (use a loop), putting the new relationship number (serial number???) into the key field (use the "Set Field" command)

c) closes the file.

HTH,

Dan

  • 2 weeks later...
  • Author

Dan,

Thanks for the reply & sorry to take so long to get back to you. You know how the holidays can be.

Your advice was a great starting point, but I had some troubles with the whole loop thing. In fact, I was trying to avoid it altogether, since I had never found loops very reliable ... until today. I'd never considered using a global as a loop counter until I saw the "Go to record by field value" option. (duh)

Here's the solution I came up with...

In my Master Item.fp5 db:

Show All Records

Omit Record

Show Omitted

Duplicate Record/Request - had to do this here to get the new serial assigned

Set Field ("global_serial", "serial")

Omit Record - This is to go back to the original record

Go to Related Record (Show, "Component")

Perform Script (Sub-scripts, External: "Component.fp5")

In my Component.fp5 db:

Created 2 new fields: loopCount & recordCount

Go to Record/Request/Page (First) - just to be safe

Set Field ("loopCount","1")

Set Field ("recordCount", "Status(CurrentFoundCount)")

Loop

Duplicate Record/Request

Set Field ("serial","CompToMaster::global_serial")

Omit Record

Set Field ("loopCount", "loopCount+1")

Go to Record/Request/Page ("loopCount")

Exit Loop If ("loopCount = recordCount + 1") - wouldn't work otherwise

End Loop

Show Omitted

Go to Record/Request/Page (Last)

Go to Related Record (Show, "CompToMaster")

Set Field ["CompToMaster::global_serial",

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.