Remove Duplicate values with a condition
pmulroney at logicaldevelopments.com.au
Tue Sep 13 02:42:13 UTC 2022
We haven't ever needed to select the first duplicate. Maybe you can sort the list so that the duplicate line that you want to not select appears first? Then run $selectduplicates() will select as you need.
> On 13 Sep 2022, at 1:00 am, Martin Obongita <martin.obongita at yahoo.com> wrote:
> Hi Paul,
> I have played around with this duplicate.
> There is this command: $selectduplicates.
> Using this command will select the second duplicate row.
> Is there a way to set the command to select the first duplicate row?
> Kind regards,
> Martin O.
> On Monday, September 12, 2022 at 03:24:37 AM GMT+3, Paul Mulroney <pmulroney at logicaldevelopments.com.au> wrote:
> Hi Martin,
> I had to do this recently where I wanted to remove any duplicates the combination of two fields - first name and last name.
> This is how I did it (Studio 10.0, but should work anywhere). Note I had to create a local var vsFullName
> # Remove duplicates - same first name and surname
> Do vlOutput.$sort($ref.LastName,kFalse,$ref.FirstName,kFalse)
> Do vlOutput.$cols.$add(vsFullName)
> Do vlOutput.$sendall($ref.vsFullName.$assign(con($sendallref.FirstName,' ',$sendallref.LastName))) ## Create special column to remove dups
> Do vlOutput.$cols.vsFullName.$removeduplicates(kTrue,kTrue)
> You might need to do something similar.
> > On 12 Sep 2022, at 4:52 am, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com <mailto:omnisdev-en at lists.omnis-dev.com>> wrote:
> > Hi ALL,
> > I have the method below to remove duplicate rows in a listDo iSQLTableColNameRowList.$sort($ref.lOriginalColName,kFalse)
> > Do iSQLTableColNameRowList.$cols.lOriginalColName.$removeduplicates()
> > The problem is it deletes all duplicate rows.
> > How do I remove duplicate rows in a list with a condition, say, remove all duplicates but check that C7(the column flag in the list) is true?
> > Kind regards
> > _____________________________________________________________
> > Manage your list subscriptions at https://lists.omnis-dev.com <https://lists.omnis-dev.com/>
> > Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com <mailto:omnisdev-en at lists.omnis-dev.com>
Q: What do you get if there are one hundred rabbits standing in a row and ninety-nine take a step back?
A: A receding hare line
Paul W. Mulroney We Don't Do Simple Pty Ltd
pmulroney at logicaldevelopments.com.au Trading as Logical Developments
www.logicaldevelopments.com.au ACN 161 009 374
Ph: +61 8 9458 3889 86 Coolgardie Street
BENTLEY WA 6102
More information about the omnisdev-en