Jump to content

Insert related new records


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

Recommended Posts

  • Newbies

Hi to all

I am designing order database. ORDR file have relationship(ORDR_ID) with ORD_Details file. How to implement things below using scripts:

1)When insert new record in ORDR insert related new records in ORD_Details with default items(from PRDCT file)

2)When changing ORDR_ID in field in ORDR file change ORDR_ID in field in ORDR_Details file

3)Change fields in the non matching records in ORDR_Details file

Thks

Link to comment
Share on other sites

quote:

Originally posted by Bayarpurev:

Hi to all

I am designing order database. ORDR file have relationship(ORDR_ID) with ORD_Details file. How to implement things below using scripts:

1)When insert new record in ORDR insert related new records in ORD_Details with default items(from PRDCT file)

2)When changing ORDR_ID in field in ORDR file change ORDR_ID in field in ORDR_Details file

3)Change fields in the non matching records in ORDR_Details file

I would need more details on questions 1 and 3 to answer them. More expanation of what you are trying to do.

To answer question 2, do NOT change ORDR_ID, ever! If you want to give the user an Order Number, then do so. But NEVER give the user access to the underlying IDs. This way they will never change. The Order Number can be changed, but none of your relationships will be broken.

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

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Consultant

Database Resources

mailto:[email protected]

http://www.database-resources.com

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

  • Newbies

quote:

Originally posted by captkurt:

I would need more details on questions 1 and 3 to answer them. More expanation of what you are trying to do.

To answer question 2, do NOT change ORDR_ID, ever! If you want to give the user an Order Number, then do so. But NEVER give the user access to the underlying IDs. This way they will never change. The Order Number can be changed, but none of your relationships will be broken.


1)My ORDR database have OrdNumber field which related to OrdNumber field of ORDdetails database(one to many relation) which have also PRTD, UnitPrice and Price fields. When insert new record in ORDR database I would like to insert new records in ORDdetails database with all the default PRTD from Product database. and when user enter OrdNumber in ORDR database it will automaticly change OrdNumber of these new records in ORDdetails database. in other word I should run a script after entering data in new OrdNumber of ORDR database which will change new OrdNumber fields of ORDR database with the same data.

2)when I use import records script in ORDdetail dabase in order to add new records with default PRDT it deletes my previous records. Why?

Thanks

[This message has been edited by Bayarpurev (edited November 13, 2000).]

Link to comment
Share on other sites

quote:

Originally posted by Bayarpurev:

1)My ORDR database have OrdNumber field which related to OrdNumber field of ORDdetails database(one to many relation) which have also PRTD, UnitPrice and Price fields. When insert new record in ORDR database I would like to insert new records in ORDdetails database with all the default PRTD from Product database. and when user enter OrdNumber in ORDR database it will automaticly change OrdNumber of these new records in ORDdetails database. in other word I should run a script after entering data in new OrdNumber of ORDR database which will change new OrdNumber fields of ORDR database with the same data.

2)when I use import records script in ORDdetail dabase in order to add new records with default PRDT it deletes my previous records. Why?]

#2: I would be that you had your import set to update existing records rather than create new records. Resetup your import format manually, then store it in the script and you should be OK.

#1: It seems to me that you are kinda doing things backwards. Adding records, then having the user change the data to match you ORDR record.

I would just have the user click a button or something to add records one at a time (or in batches or whatever), after they have correctly setup the ORDR record. Setup these records by running a script in the ORD_Details database or via the relationship. This will corrctly setup your IDs and such.

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

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Consultant

Database Resources

mailto:[email protected]

http://www.database-resources.com

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

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