Jump to content

Copying records from one table to another


Cin

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

Recommended Posts

I am writing a solution where I want to post information from some records in one table to another table. An example is:

I have a work order that I want to post to a General Ledger. In the GL I need to add new records from a sort in the work order table. I am having trouble getting it right. Do I create the script from the Work order table or from the GL table? Do I need multiple scripts (one finding records and the other adding new records) It feels like It should be easy but I'm not getting it. Can anyone point me in the right direction?

Cindy

Link to comment
Share on other sites

Set up a relationship from a global field in the GL table to the id in the Work Order table and a relationship from a WorkOrderID field in the GL table to the id in the Work Order table. Start your script on a layout associated with the Work Order table. Set the global field in the GL table with the first record's id. Commit the change. Move to a layout for your GL table, create a new record, and set the new record's fields with data using the relationship. Go back to the Work Order layout, move to the next record, and repeat for the remaining records. In semi-pseudocode,

Go to Layout [Work Order]

{find desired records}

Loop

Set Field [GL::globalid; id]

Commit Records/Requests

Go to Layout [GL]

New Record/Request

Set Field [WorkOrderid; globalid]

Commit Records/Requests

Set Field [data1; Work Order::data1]

Set Field [data2; Work Order::data2]

...

Go to Layout [Work Order]

Go to Record/Request/Page [Exit after last; Next]

End Loop

Link to comment
Share on other sites

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