﻿<?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 » WinForms (How do I?)  » How to check for duplicates on current business object</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 27 May 2026 22:37:41 GMT</lastBuildDate><ttl>20</ttl><item><title>How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30192.aspx</link><description>I am using a BO with multiple rows taken from the Database Table and want to ensure that I do not have any duplicates (On the BO) before I save.&lt;br/&gt;&lt;br/&gt;If I was doing this against the database Table, I would issue someting like:&lt;br/&gt;&lt;br/&gt;Select Country , Count(Country) as MyCount from MyTable Group by Country&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and then Test that myCount was not greater than 1&lt;br/&gt;&lt;br/&gt;Is there any similar construct I can use for Business Object&amp;nbsp; &amp;nbsp;i.e. be able to search through the BO and let it throw up any duplicates.</description><pubDate>Tue, 26 Jul 2011 11:05:27 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30204.aspx</link><description>Hi Gerard,&lt;br/&gt;&lt;br/&gt;I compiled all my SF application with .Net 4 runtimes, it is much better, faster and reliable than 2.0, also there are new functionality in version 4 that does not exist in the previous one, so you can go ahead and use 3.5 or better yet 4.&lt;br/&gt;&lt;br/&gt;I had used Linq briefly in one of my applications and yes it is very nice and will get you the results you are looking for, so go ahead and use it without hesitation.</description><pubDate>Tue, 26 Jul 2011 11:05:27 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30202.aspx</link><description>Sorry, but I am affraid I have no expertise on the subject to give you a more accurate answer.&lt;br/&gt;&lt;br/&gt;Maybe someone else will chime in and help you with that. You could also run a test on different approaches and decide which goes better for your conditions.</description><pubDate>Tue, 26 Jul 2011 07:47:22 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30201.aspx</link><description>Hi Ivan.&lt;br/&gt;&lt;br/&gt;I have just started to play around with Linq statements (from a Datatable) and it appears to be quite easy to 'Group By' using the Inernal Table from the BO. In that Linq stuff only came &amp;nbsp;in in .Net 3.5 , would you anticipate any problems using this with SF (I had any projects running on Net 2) . I have changed the Project to 3.5 and have not noticed any problems yet. I would imagine that a Linq group By Statement might be faster than itrating through each BO and doing a search for a duplicate on each row. The particular maintanance forms that I want to validate could have thousands of rows so speed will be a factor</description><pubDate>Tue, 26 Jul 2011 06:59:52 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30199.aspx</link><description>OK Gerard. Sorry, I thought you wanted a BO free of the duplicates. In fact you want the ones that are duplicates.&lt;br/&gt;&lt;br/&gt;There might be easier ways to do it, but I would iterate through your BO and check each row if there is any other with the same content. Everytime I found one, I would store it in some kind of array, collection or even another instance of the same BO.&lt;br/&gt;&lt;br/&gt;To look for duplicates, you can use the BO.CurrentDataTable.Select function, as in:&lt;br/&gt;&lt;br/&gt;MyBO.CurrentDataTable.Select("MyColumnName = " &amp;amp; MyColumnCurrentValue &amp;amp; " AND MyPrimaryKeyColumnName &amp;lt;&amp;gt; " &amp;amp; MyCurrentPrimaryKeyValue).Length&lt;br/&gt;&lt;br/&gt;If this line returned anything greater than 0 this would tell you this row had a duplicate and you could add it to your DuplicatesBO to show the user once finished.</description><pubDate>Mon, 25 Jul 2011 16:22:40 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30198.aspx</link><description>Hi Michel. Thanks for your reply.&lt;br/&gt;&lt;br/&gt;This looks like what I want, &amp;nbsp;but I see its another chargeable piece of software (Not that much I admit but all the bits are starting to add up (e.g. Vis Studio, SF,DEVEX Grid, Devex Reports, Excel Creator etc&amp;nbsp; and 3 or 4 other bits and pieces... its starting to get a bit difficult to keep track of them all !!......). I will try to exhaust other possibilities first , and if I make no headway, may have to come back to this.</description><pubDate>Mon, 25 Jul 2011 14:54:38 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30197.aspx</link><description>Hi Ivan. I am not seeing this. Maybe an example might clarify.&lt;br/&gt;&lt;br/&gt;Say in the BO . I have following:&lt;br/&gt;&lt;br/&gt;[quote]IRELAND&lt;br/&gt;UK&lt;br/&gt;USA&lt;br/&gt;JAPAN&lt;br/&gt;CHINA&lt;br/&gt;IRELAND&lt;br/&gt;FRANCE&lt;br/&gt;BELGIUM&lt;br/&gt;CHINA[/quote]&lt;br/&gt;&lt;br/&gt;I want the duplicates in this (So that I can display an error message , as there should not be any duplicates) . So I want returned:-&lt;br/&gt;&lt;br/&gt;[quote]IRELAND&lt;br/&gt;CHINA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [/quote]&lt;br/&gt;&lt;br/&gt;(If I was doing this in Sql, I would use a Select Country ,Count(Country) as MyCount from Mytable Group by Country &amp;nbsp; (And anywhere MyCount &amp;gt; 1 are the duplicates)</description><pubDate>Mon, 25 Jul 2011 14:50:12 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30196.aspx</link><description>Did you read Paul's post? Or maybe I am misunderstanding what you are looking for.&lt;br/&gt;&lt;br/&gt;&lt;font size="2"&gt;[codesnippet]MyBO.CopyDataFrom(MyOtherBO.CurrentDataTable.DefaultView.ToTable(True, New String() {"DistictColumn-ColumnName"}), MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)&lt;/font&gt;&lt;font size="2"&gt;[/codesnippet]&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;font size="2"&gt;This should copy&amp;nbsp;only "distinct" rows from MyOtherBO to MyBO, based on the "DistinctColumn-ColumnName".&lt;/font&gt;</description><pubDate>Mon, 25 Jul 2011 13:01:16 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30195.aspx</link><description>Hi Ivan. Thanks for replying.&lt;br/&gt;&lt;br/&gt;I have had a look at the thread and the CopydataFrom method but cannot see any option to copy 'Just' duplicated records, or insert a 'Group By' statement.&amp;nbsp; An example of a CopyDataFrom to copy duplicated records only would be very helpful </description><pubDate>Mon, 25 Jul 2011 11:13:46 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30194.aspx</link><description>Hi Gerard,&lt;br/&gt;&lt;br/&gt;I use QueryAdataset for that purpose (locally querying data in a BO in T-SQL). You'll find it here &lt;a href="http://www.queryadataset.com/"&gt;&lt;a href="http://www.queryadataset.com/"&gt;http://www.queryadataset.com/&lt;/a&gt;&lt;/a&gt;</description><pubDate>Mon, 25 Jul 2011 10:37:26 GMT</pubDate><dc:creator>Michel Levy</dc:creator></item><item><title>RE: How to check for duplicates on current business object</title><link>http://forum.strataframe.net/FindPost30193.aspx</link><description>See if this one helps:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://forum.strataframe.net/FindPost20253.aspx"&gt;&lt;a href="http://forum.strataframe.net/FindPost20253.aspx"&gt;http://forum.strataframe.net/FindPost20253.aspx&lt;/a&gt;&lt;/a&gt;</description><pubDate>Mon, 25 Jul 2011 10:01:27 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item></channel></rss>