How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?


How do I use CopyDataFrom to remove duplicates from BO populated by...
Author
Message
Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi All.

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

Replies
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi 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... Wink

Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)Advanced StrataFrame User (698 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Ivan George Borges (10/21/2008)
Hi Marcia.

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... Wink

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 Smile

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.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Marcia G Akins - 17 Years Ago
Ivan George Borges - 17 Years Ago
Marcia G Akins - 17 Years Ago
Paul Chase - 17 Years Ago
Marcia G Akins - 17 Years Ago
Paul Chase - 17 Years Ago
Marcia G Akins - 17 Years Ago
                         Hi Paul. I just wanted to thank you so much for your great advice....
Marcia G Akins - 17 Years Ago
                             Marcia I'm glad I was able to help!! ;) Paul
Paul Chase - 17 Years Ago
                                 Yep, that was a lot eaiser! :w00t:
Ivan George Borges - 17 Years Ago
                                     Good answer, Paul. :)
Trent L. Taylor - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search