Showing results for 
Search instead for 
Do you mean 
Reply

Automating Line Item Copy

I have a situation where I need to copy the line item I currently have open to a new line item with some modifications. I'm pretty confident that I can do this by exporting the model XML (or some portion, most likely), and then using Unattended Engineer to create a new line item from the exported XML.

 

My question is this: Is there a way to automate this import into a new line item WITHOUT Unattended Engineer? I cannot think of a way to create a new line item while I have one open. 

2 REPLIES

Re: Automating Line Item Copy

[ Edited ]

I think, in theory you can do it programmatically from the UI modifying the Project databases.

 

1. We need to create a copy of row with your line item in dbo.LineItem and dbo.Model changing the LineItem_ID to the unique value. 

This will create a line item with fully reverted model.

 

2. We need to modify dbo.Model_Part, dbo.Model_Property and dbo.Model_SubPart tables. We need to create the copies of the rows with the LineItem_ID of your current project changing this ID to the new LineItem_ID.

 

Forum.JPG

 

 

 

I did it using the Management Studio and it works (at least I was able to create a new line item and get the values of properties copied)

 

Probably we'd like to do the step 2 applying to all the tables which contain the LineItem_ID attribute. To make the behavior correct in  more generic cases.

Atl least we definely need to have modified the dbo.Model_Connection dbo.Model_Connected_Parts because such tags exist in the export xml file.

 

 

 

Re: Automating Line Item Copy

Thanks Yuri, I hadn't even considered manipulating the projects DB directly. I'll explore that option.