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

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

Recommended Posts

Posted

Hi

I have recently written a script that copies data from a bunch of records into another database recordset. The problem is, even though the script I feel is close to perfect, for some reason all records from my Database get copied to the other database, even when I have an 'if' statement to make sure that I am only copying the files over that I want.

This is the structure

Quote_Database - Quote_Item_Database

Order_Database - Order_Item_Database

I am trying to copy (duplicate is the better word probably) certain records from Quote_Item_Database into Order_Item_Database and create a new Order in Order_Database to make the relationship intact.

Is their any hints anyone to give when doing such a thing? I have to rely on the Copy and Paste functions in my script to copy the field values over. Plus, Is the if statement of if

enough to filter the only records I want into the Order_Item_Database? Because that should do it, but it doesn't. Is it my scripting expertise or am I forgetting something?

Thanxs, and hope that makes sense, again wink.gif" border="0

Cheers

Steve Griff

Posted

I guess I'm a little confused about exactly you are doing. If you are copying records by creating new records, why the need to match ID's? If you are copying only data, why copy it, just create a relationship based upon Quote ID and use the related data.

I much prefer the import function to "copy" a set of records from one file to another. I just used this approach to move Invoice Line Items to a Shipper Line Items file. I would also try to avoid the use of copy and paste and use Set Field instead, it sounds like you already have the relationship.

-bd

Posted

Hi there.

A bit more info...

I have a Quote database that has related to it Quote_Item DB which is then attached to a Product database.

Quote - Quote_Item - Product

If the Quote becomes approved, All the quote items that are related to the Quote by Quote_ID are copied to a Order_Item database which is linked to an Order Database. See what I'm trying to get at? smile.gif" border="0 (I really should tried to have explained it like this the first time).

Basically I want to copy related Quote_Items to Order_Items.

I was wondering what was the best way to get to doing this job. The solution I managed to do did not work so hopefully someone else could explain how to do it for me.

Thanxs

Steve Griff

Posted

I was doing this between Invoice Items and Shipper Items yesterday. I would definitely use an import step. You will need to:

1) Isolate the Quote Items in a found set (you can use a "Go to Related Record" from the Quote file)

2) Create a new order and capture the key field used to connect Orders to Order Items.

3) Import the Quote Items to the Order Items file

4) Replace the Key field in the Order Items imported records with the key field you caputured from the new Order you created. This will connect the Order with the import Order Items.

-bd

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