![]() |
romaldus 10/8/2016 |
Hello, [size="2"]I have a master-detail table relationship. I would like to use the import functionality so that when a master record is added, its children records are also added using some non-mapped source data. [/size] For example, I have a source excel file line: customer_id invoice_id product_A product_B product_C --------------- ------------ ------------ ------------ ------------ A abc123 3 5 1 B def234 2 3 2 but in the database I have a master-detail schema: master: customer_id invoice_id (pk) -------------- ------------ A abc123 B def234 detail: invoice_id product_id amount ------------- ------------- ---------- abc123 A 3 abc123 B 5 abc123 C 1 def234 A 2 def234 B 3 def234 C 2 So, when I import from the excel file, I want to add records to both master and detail tables. I know how to use events but do you thing it's possible to take data from excel columns that are not mapped to tables (i.e. product_A, product_B, etc) Regards, Jim
|
![]() |
jimbeam author 10/9/2016 |
Thanks for replying. |
A
|
Abul 10/10/2016 |
Thanks for replying. Maybe I was not clear. I wrote that "I know how to use events", so obviously I am looking at this direction <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=80438&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> My question was: Can I use events to intercept the import process and then use data from the source file to write to two tables? Import only maps data to one table (i.e. master) but I need to read other source columns so that I insert data to another table also (i.e. details). I hope I am describing a little better now. Regards Jim
|
![]() |
Sergey Kornilov admin 10/10/2016 |
Use BeforeInsert event to insert record to either table or two both tables at once: |
![]() |
jimbeam author 10/10/2016 |
Hello Abul, |
![]() |
jimbeam author 10/10/2016 |
Use BeforeInsert event to insert record to either table or two both tables at once: http://xlinesoft.com...sert_record.htm
|
![]() |
Sergey Kornilov admin 10/11/2016 |
This is actually a question that you have to ask yourself - how do I import two tables data from one source file? How did you plan it to work? |
![]() |
jimbeam author 10/11/2016 |
This is actually a question that you have to ask yourself - how do I import two tables data from one source file? How did you plan it to work?
|
![]() |
Sergey Kornilov admin 10/11/2016 |
I don't think you understand the question. I'm not talking about programming. I'm talking about the structure of import file, how do you fit two tables data into a single Excel sheet - this is the question you need to ask yourself before anything else. |
![]() |
jimbeam author 10/12/2016 |
I don't think you understand the question. I'm not talking about programming. I'm talking about the structure of import file, how do you fit two tables data into a single Excel sheet - this is the question you need to ask yourself before anything else. The answer on how to perform that import will be different depending on import file structure.
|
![]() |
lefty 10/14/2016 |
Thanks for getting back on this. I describe the import file structure in my first post. This import file structure is given by a customer as they are gathering all their data using excel spreadsheets. One line of that import file should go into one master record and few details records. Regards, Jim
|
![]() |
jimbeam author 10/15/2016 |
Thanks for taking the time to reply. |
![]() |
jimbeam author 10/15/2016 |
Ok, I figured out a good-enough-for-now solution:
|