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

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

Recommended Posts

Posted

Hi All, I am trying to migrate a 260 field ONE FILE DB to a newly designed db with many related files. I want to write a script to migrate the data and create the appropriate related records. THE EASIEST way would be to use a script step that created portal records. But it seems to me like i need to run an external script for each related file which sucks big time. Am i missing something? Can i create portal records from a parent file script?? I am trying to avoid using multiple globals and external scripts for every single related record. Basically i want to create new Portal record, set portal fields.. from the parent..

rw

Posted

I usually use the following technique to create related records.

In the parent database I have a constant field which is defined as a calculation set simply to 1. I usually call this gConstant.

I the child database I have a number field called TempRelationship.

From the parent file I create a relationship to the child file using gConstant as the local match field and TempRelationship as the foreign match field. Make sure that the "Allow creation of related records" is checked in the relationship dialog box.

A script like the following will then allow me to create a record in the child database.

# Create the related record.

Set Field [ Child_gConstant_TempRelationship::Field1, LocalField1 ]

# Set other fields for the related record.

Set Field [ Child_gConstant_TempRelationship::Field2, LocalField2 ]

Set Field [ Child_gConstant_TempRelationship::Field3, LocalField3 ]

# Break the temporary relationship so that a new record can later be created.

Set Field [ Child_gConstant_TempRelationship::TempRelationship, "" ]

This script will create a new record in the child database and set the Field1 field there to whatever value LocalField1 contains. It will create the record because TempRelationship is empty when the script begins. That first step not only create the record and sets the value of the Field1 field, but also sets the value of the TempRelationship field to 1 (so that the relationship will be valid). Other fields are then set, and finally the relationship is broken by clearing out the value in TempRelationship so that the next time a field is set through that relationship a record will be created.

Chuck

This topic is 7925 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.