Remove Duplicate values with a condition

Phil Phil at pgpotter.co.uk
Mon Sep 12 08:29:29 UTC 2022


Martin,

I also had to do something similar recently...

I chose to do a normal search comparing a line with the next line in the 
list, which would of course leave the last version of the entry...

so something like

iSQLTableColNameRowList.$search(.$ref.lOriginalColName=$ref.[iSQLTableColNameRowList
.$line+1].lOriginalColName,ktrue,kfalse,ktrue,ktrue)

If you run this, and compare the selected lines with what you want 
deleted, it probably will give you what you want.

So then just delete selected lines

Phil.

On 12/09/2022 01:24, Paul Mulroney via omnisdev-en 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.
>
> Regards,
> Paul.
>
>
>> On 12 Sep 2022, at 4:52 am, Martin Obongita via omnisdev-en <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
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>
> Is it wrong that only one company makes the game Monopoly?



More information about the omnisdev-en mailing list