BO.CopyDataFrom() for new records


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent,



I am adding new record to a temporary BO, then from the MainBO I use the MainBO.CopyDataFrom(TempBO, AppendDataToTableFromDefaultView) to move those records to the main BO, I noticed from the help file that the row state of the TemporaryBO are accepted, then those records needs to be identify and modified in the MainBO in order to change their state, I have the following code witch works, but I wonder if there is any shortcut to avoid having to enumerate the MainBO:





'----------------------------------------------------

'-- Move the new record to the BizTransactionItemsStock1 BO

' and clear the temporary BO

'----------------------------------------------------

If Me.BizTransactionItemsStock_ForNewRecords.Count > 0 Then

'-- Reset filter condition to show all selected cards.

Me.BizTransactionItemsStock1.Filter = ""



'-- Copy new records to the main Stock BO

Me.BizTransactionItemsStock1.CopyDataFrom(Me.BizTransactionItemsStock_ForNewRecords, BusinessCloneDataType.AppendDataToTableFromDefaultView)

Me.BizTransactionItemsStock_ForNewRecords.Clear()



'-- Loop through all new records as set their state as Added.

Me.BizTransactionItemsStock1.Filter = "PK_TransactionItemsStock < 0"

For Each StockBO As bizTransactionItemsStock In Me.BizTransactionItemsStock1.GetEnumerable

StockBO.CurrentRow.SetAdded()

Next



End If



Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
If you are wanting the row states to be "Added" then what you are doing will work great since, as you mentioned, the Row State will be "Unchanged."  Long term an additional option may be helpful here to allow the RowStates to be left intact.
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (06/06/2009)
Long term an additional option may be helpful here to allow the RowStates to be left intact.


Are you a mind reader also? Tongue



With that option, probably you may just condition the "CurrentRow.AcceptChanges()" in the BusinessLayer.vb class.



P.S.

I am also falling in love with the BO.Filter functionality, in this project I have to do a lot of data manipulation and from my young experience with SF/.NET this has been much more easier than working with VFP cursors.



Thanks again!

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Are you a mind reader also?

LOL...I have my moments! BigGrin

I am also falling in love with the BO.Filter functionality, in this project I have to do a lot of data manipulation and from my young experience with SF/.NET this has been much more easier than working with VFP cursors.

Thanks!  I am really glad to hear that it is meeting your needs!!! Smile

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