Need to compare two datagrids

Peter Haworth pete at lcsql.com
Mon May 5 17:42:58 EDT 2014


Hi Skip,
Following Phil's suggestion, I think you could do this using the filter
command, something like this:

put the dgText of group dg1 into tdg1Text
put the dgText of group dg2 into tdg2Text
set the itemdelimiter to tab
repeat for each line rLine in tdg1Text
   filter lines of tdg2Text with item 1 of of rLine into tTemp
   if tTemp is empty then
      put rline & return after tdg4Text
   else
      put rLine & return after tdg3Text
   end if
end repeat

set the dgText of group dg3 to tdg3Text
set the dgText of group dg4 to tdg4Text

Haven't tested that and I'm not sure how efficient it would be if there are
a large number of rows in dg1 and/or dg2 but it's a starting point.  Oh,
and you'd need to be on whatever version of LC the new filter command
syntax was introduced in (6.1?)

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>


On Mon, May 5, 2014 at 12:52 PM, Magicgate Software - Skip Kimpel <
skip at magicgate.com> wrote:

> I have two datagrids that I need to compare column 1.  I then need to
> separate these two lists out into additional datagrids.
>
> For instance, datagrid 1 contains three columns:
> 1234, ItemA, ItemDetails
> 1235, ItemB, ItemDetails
> 1236, ItemC, ItemDetails
>
> Datagrid 2 contains three columns:
> 1234, ItemA, ItemDetails
> 1235, ItemB, ItemDetails
>
> After the comparison I need a DG that has similar items and a separate DG
> that has unique items:
> Datagrid 3 would result in: (same items)
> 1234, ItemA, ItemDetails
> 1235, ItemB, ItemDetails
>
> Datagrid 4 would result in: (unique items)
> 1236, ItemC, ItemDetails
>
> My head is spinning in datagrid code!  Any help would be greatly
> appreciated!
>
> SKIP
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list