Copy Current Record


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I did something similar a couple of minutes ago.  I added a BO to the form and named it PartTempBO.  When the user clicks the button, I fill that BO with the FillByPrimaryIndex method from the index of the primary BO.  Then, I run the Add() method on the primary BO.  I manually set the properties of the new record to the properties of the temp record (except the differentiating field...partnum); however, after reading your reply, I think I will try the walk the collection route.  That would be easier...especially, since I know we will be modifying that data table's structure over the next several weeks.

Thanks a lot for your help!
Bill

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yeah, you can just create a shared (sorry static since you are C# Wink) method that copies the data out of the row.  This is probably something we could add to the Tools.Common class, but just haven't as of yet.

'-- Save off the current row
Dim copyRow As DataRow = MyBo.CurrentRow
MyBo.NewRow()

'-- Now update each of the columns within the new row.  You may want to test
'    on certain column names to be excluded, such as PK fields.
For each col as DataColumn In MyBo.CurrentDataTable.Columns
    MyBo.Items(col.ColumnName) = copyRow.Item(col.ColumnName)       
Next

I didn't run this to make sure that the copyRow didn't move (I just typed it in here) but it should be close enough to get you going.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I searched the forum in vain for an answer to this.  How do I copy the current record of  BO to a new record in the same BO, reset a couple of values, navigate to that new record and allow the user to alter any necessary fields before saving?  This seems very simple.

Thanks,
Bill

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search