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

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