Skip 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.

Script Help - Duplicating

Featured Replies

Hi,

I'm working on a script now that is supposed to look through all of my records, find those with a particular characteristic, duplicate those records, then copy and paste certain fields into other fields and clear the originally copied field. It looks like this...abbreviated.

Show All records

Perform Find

Duplicate Record

Copy [select; Forms::Field2]

Paste [select; Forms::Field1]

Clear [select; Forms::Field2]

Enter Browse Mode

The copy/paste/clear function works great. The problem is that it only performs the script on the first record it comes to that fulfills the Find requirements and I'd like it to go through and handle all records that meet the Find requirements.

Any ideas?

Thanks.

Hi j,

It is really not clear to me what you are trying to accomplish.

Why not start by telling us you are wanting to have happen.

BTW, Why are't you using the Set Field Script step?

Lee

  • Author

Lee,

This is going to be difficult to explain. A database run by one of our units has a record for each student who submits to us paperwork. Each student may send to us three installments of paperwork that are unrelated over time so the original designer set the records up to capture 3 different 'Submissions' of paperwork on each record. This is not a good design.

What I wanted to do was to take, for example, John Doe who has 2 Submissions with us and break those into two records, one submission each. To do so, I would need to copy the info in Submission 2 into the Submission 1 fields. Once that is done I can get rid of the Submission 2 fields alltogether.

Clear as mud, right? It's not easy to explain but there you have it.

since this will be used as a one time deal to seperate your data into a related table, try the following:

Create the following Global fields

gStudentID

gSubmission1

gSubmission2

gSubmission3

Create a Submissions table if you have not already done so.

For now, set the foreign key in the Submissions table (fkStudentID) to be an auto-calculation of gStudentID.


Go to layout [ Students ]

Show All Records []

Go to Record [First]



Loop

Set Field [ gStudentID; StudentID ]

Set Field [ gSubmission1; Submission1 ]

Set Field [ gSubmission2; Submission2 ]

Set Field [ gSubmission3; Submission3 ]



Go to layout [ Submissions ]



If [ not IsEmpty ( gSubmission1 ) ]

New Record []

Set Field [ Submissions::Submission; gSubmission1 ]

End If



If [ not IsEmpty ( gSubmission2 ) ]

New Record []

Set Field [ Submissions::Submission; gSubmission2 ]

End If



If [ not IsEmpty ( gSubmission3 ) ]

New Record []

Set Field [ Submissions::Submission; gSubmission3 ]

End If



Go to layout [ Original Layout ]

Go to Record [ Next; Exit After Last ]

End Loop

Once successfully done and Verified, you can trash the global fields, remove the auto entry option in the fkStudentID, and delete the Submission fields in the Student table as well.

Edited by Guest
Clarification

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.