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

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

Recommended Posts

Posted

I would like to copy data from one table to another table.

I have the following tables...

t_Manage_Procedure_List

-----------------------------------

KEY (auto)

Name

Description

t_Manage_Procedure_Items

-----------------------------------

KEY ( = t_Manage_Procedure_List KEY)

Description

t_Manage_Procedure_List = t_Manage_Procedure_Items (allow creation/deletion of records)

t_User_Procedure_List

-----------------------------------

KEY (auto)

Name

Description

t_User_Procedure_Items

-----------------------------------

KEY ( = t_User_Procedure_List KEY)

Description

t_User_Procedure_List = t_User_Procedure_Items (allow creation/deletion of records)

Also, relation t_Manage_Procedure_List = t_User_Procedure_List

In case you're wondering, the relation allows me to show the List and a portal of records (items).

I want to create a script to do the following (psuedocode)...

#1.) Create a new t_User_Procedure_List record.

#2.) Copy t_Manage_Procedure_List's "Name" and "Description" fields to t_User_Procedure_List's.

#3.) Copy all associated items from t_Manage_Procedure_Items (i.e. belonging to t_Manage_Procedure_List = KEY) to t_User_Procedure_Items now associated with the new record created in #1.

Pictorially, here is what would happen...

t_Manage_Procedure_List (shown in "Layout 1")

-----------------------------------

KEY: 1

Name: Procedure 1

Description: Procedure 1 Description

KEY: 33

Name: Procedure 33

Description: Procedure 33 Description

KEY: 123

Name: Procedure 123

Description: Procedure 123 Description

(etc.)

t_Manage_Procedure_Items

-----------------------------------

KEY: 1

Description: Item 1 Description for Procedure 1

KEY: 1

Description: Item 2 Description for Procedure 1

KEY: 1

Description: Item 3 Description for Procedure 1

KEY: 33

Description: Item 1 Description for Procedure 33

KEY: 33

Description: Item 2 Description for Procedure 33

KEY: 123

Description: Item 1 Description for Procedure 123

(etc.)

So, the user clicks on Procedure 1 from Layout 1...now I want to copy all the associated data for Procedure 1 to a new t_User_Procedure_List record and show it in Layout 2, which might end up looking like this...

t_User_Procedure_List (shown in "Layout 2")

-----------------------------------

KEY: 188

Name: Procedure 1

Description: Procedure 1 Description

t_User_Procedure_Items (Shown in portal on "Layout 2")

-----------------------------------

KEY: 188

Description: Item 1 Description for Procedure 1

KEY: 188

Description: Item 2 Description for Procedure 1

KEY: 188

Description: Item 3 Description for Procedure 1

NOTE: I have access to the t_Manage_Procedure_List from "Layout 1". The t_User_Procedure_List would be shown in "Layout 2".

Any idea how one might script this??

Many, many thanks for any ideas or solution for this.

Many regards,

Kevin

Posted

Basically, I have a layout that shows the portal of related records to the master record. I go to that layout, then using the goto first/next on the portal, I loop and concatenate the strings together, separating them with a <CR>. Then I go to the layout with the target portal I want to copy the records over to, create a new record, then using the portal row last, walk the string with the <CR>'s backwards and set the field in the portal to each string. Took some doing and debugging on my part to get it all to work right, but it works like a charm.

Hope that helps.

Kevin

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