﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 18 Apr 2026 23:36:38 GMT</lastBuildDate><ttl>20</ttl><item><title>How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20246.aspx</link><description>Hi All.&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;TIA.&lt;/P&gt;&lt;P&gt;Marcia</description><pubDate>Wed, 22 Oct 2008 09:12:33 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20266.aspx</link><description>Good answer, Paul. :)</description><pubDate>Wed, 22 Oct 2008 09:12:33 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20259.aspx</link><description>Yep, that was a lot eaiser! :w00t:</description><pubDate>Tue, 21 Oct 2008 18:15:52 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20258.aspx</link><description>Marcia&lt;/P&gt;&lt;P&gt;I'm glad I was able to help!! ;) &lt;/P&gt;&lt;P&gt;Paul</description><pubDate>Tue, 21 Oct 2008 16:25:34 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20257.aspx</link><description>Hi Paul.&lt;/P&gt;&lt;P&gt;I just wanted to thank you so much for your great advice. Once you explained how this worked, everything worked out great.&lt;/P&gt;&lt;P&gt;Thanks again for staying with a newbie like me :)</description><pubDate>Tue, 21 Oct 2008 15:56:23 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20256.aspx</link><description>[quote][b]Paul Chase (10/21/2008)[/b][hr]&lt;P&gt;It works like Select Distinct ColumnName(s) fromTableName.&lt;/P&gt;&lt;P&gt;[/quote]&lt;/P&gt;&lt;P&gt;Perfect - thanks for the explanation :) Now I know why my code was blowing up with a "column active_flg does not belong to table client" :D</description><pubDate>Tue, 21 Oct 2008 15:41:46 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20255.aspx</link><description>[quote]Thanks - that does help. Now, if I use that syntax (converted to C#, of course ;)), will it use that column to determin which ones are the duplicates but copy all the other columns?[/quote]&lt;/P&gt;&lt;P&gt;Hiya Marcia&lt;/P&gt;&lt;P&gt;It works like Select Distinct ColumnName(s) fromTableName.&lt;/P&gt;&lt;P&gt;You will need to add the columns just as you would with a regular select distinct statement&lt;/P&gt;&lt;P&gt;So something like &lt;/P&gt;&lt;P&gt;Me.RealBizObject.CopyDataFrom(Me.BrowseBizobject.CurrentDataTable.DefaultView.ToTable(&lt;BR&gt;True, New String() {"Cus_pk","cus_Name","Cus_anotherfld"}), MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)&lt;/P&gt;&lt;P&gt;= &lt;/P&gt;&lt;P&gt;Select Distinct cus_pk,cus_name,Cus_anotherfld from sometable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;:D</description><pubDate>Tue, 21 Oct 2008 15:15:53 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20254.aspx</link><description>[quote][b]Paul Chase (10/21/2008)[/b][hr]Hi Marcia,&lt;P&gt;You can do something like this to copy only distinct rows from one&amp;nbsp;bo&amp;nbsp;to another. &lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.RealBizObject.CopyDataFrom(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.BrowseBizobject.CurrentDataTable.DefaultView.ToTable(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;() {&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"DistictColumn-ColumnName"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}),&lt;FONT size=2&gt; MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable&lt;/FONT&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;[/quote]&lt;/P&gt;&lt;P&gt;Hi Paul.&lt;/P&gt;&lt;P&gt;Thanks - that does help. Now, if I use that syntax (converted to C#, of course ;)), will it use that column to determin which ones are the duplicates but copy all the other columns?</description><pubDate>Tue, 21 Oct 2008 13:48:40 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20253.aspx</link><description>Hi Marcia,&lt;/P&gt;&lt;P&gt;You can do something like this to copy only distinct rows from one&amp;nbsp;bo&amp;nbsp;to another. &lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.RealBizObject.CopyDataFrom(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.BrowseBizobject.CurrentDataTable.DefaultView.ToTable(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;() {&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"DistictColumn-ColumnName"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}),&lt;FONT size=2&gt; MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable&lt;/FONT&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Tue, 21 Oct 2008 13:01:32 GMT</pubDate><dc:creator>Paul Chase</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20250.aspx</link><description>[quote][b]Ivan George Borges (10/21/2008)[/b][hr]Hi Marcia.&lt;P&gt;As for how to filter the duplicated records, you could add a new Column to your BO for that purpose. &lt;/P&gt;&lt;P&gt;[codesnippet] &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub MyBO_CurrentDataTableInitialized() Handles MyBO.CurrentDataTableInitialized&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.CurrentDataTable.Columns.Contains("myb_Duplicated") = False Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.CurrentDataTable.Columns.Add("myb_Duplicated", System.Type.GetType("System.Boolean"))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;(You probably need to create the custom property for that column too)&lt;/P&gt;&lt;P&gt;Then you could go through all your records testing for duplicated ones, and flaging then as so. Filter on that flag before the CopyDataFrom.&lt;/P&gt;&lt;P&gt;Hope I could make some sense... ;)[/quote]&lt;P&gt;Hi Ivan.&lt;P&gt;Thanks so much for the quick response. I wish I could say that this makes sense to me, but unfortunately, it doesn't :)&lt;P&gt;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.</description><pubDate>Tue, 21 Oct 2008 10:15:13 GMT</pubDate><dc:creator>Marcia G Akins</dc:creator></item><item><title>RE: How do I use CopyDataFrom to remove duplicates from BO populated by Browse Dialog?</title><link>http://forum.strataframe.net/FindPost20248.aspx</link><description>Hi Marcia.&lt;P&gt;Maybe you could drop another instance of your BO in your form and use it as&amp;nbsp;your BrowseDialog's&amp;nbsp;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. &lt;/P&gt;&lt;P&gt;As for how to filter the duplicated records, you could add a new Column to your BO for that purpose. &lt;/P&gt;&lt;P&gt;[codesnippet] &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub MyBO_CurrentDataTableInitialized() Handles MyBO.CurrentDataTableInitialized&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.CurrentDataTable.Columns.Contains("myb_Duplicated") = False Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.CurrentDataTable.Columns.Add("myb_Duplicated", System.Type.GetType("System.Boolean"))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;(You probably need to create the custom property for that column too)&lt;/P&gt;&lt;P&gt;Then you could go through all your records testing for duplicated ones, and flaging then as so. Filter on that flag before the CopyDataFrom.&lt;/P&gt;&lt;P&gt;Hope I could make some sense... ;)</description><pubDate>Tue, 21 Oct 2008 09:56:58 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item></channel></rss>