I created a view that is a three table join so that I can use this view to populate my BO using the BrowseDialog. The problem is that this may result in multiple records in the BO that gets populated. I do not want the "real" BO being handled in my form to contain these mutliple records. So how can I use CopyDataFrom to ensure that I get only the DISTINCT records for my "real" BO?
TIA.
Marcia
Maybe you could drop another instance of your BO in your form and use it as your BrowseDialog's BusinessObjectToPopulate. Then in the BrowseDialogClosed method, if a OK was pressed by the user, you could filter your populated BO as needed and use the CopyDataFrom to copy the records to your primary BO.
As for how to filter the duplicated records, you could add a new Column to your BO for that purpose.
Private Sub MyBO_CurrentDataTableInitialized() Handles MyBO.CurrentDataTableInitialized If Me.CurrentDataTable.Columns.Contains("myb_Duplicated") = False Then Me.CurrentDataTable.Columns.Add("myb_Duplicated", System.Type.GetType("System.Boolean")) End If End Sub
(You probably need to create the custom property for that column too)
Then you could go through all your records testing for duplicated ones, and flaging then as so. Filter on that flag before the CopyDataFrom.
Hope I could make some sense...
Hi Ivan.
Thanks so much for the quick response. I wish I could say that this makes sense to me, but unfortunately, it doesn't
I have used the CopyDataFrom method before when there was no chance of pulling back duplicate records. Basically, I am after a way to do a "SELECT DISTINCT" from the BrowseDialog BO into the "real" BO.