Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6446 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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

Posted

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.

Posted (edited)

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

This topic is 6446 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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