80
Views
6
Comments
Check for duplicates in list based on the current date and account number
Application Type
Reactive
Platform Version
11.14.0 (Build 34092)

Is there a way to check for duplicates based on the current date 

USECASE:

Record with Account Number 123456 on 20/01/2022 cannot exist in duplicate on 20/01/2022

but can that same account number can exist on 21/01/2022 for

Is there anyway to achieve this? 

Thank you in advance

2016-04-22 00-29-45
Nuno Reis
 
MVP

Hello Anna.


To detect duplicates, you can do a select with group by and count occorrences.

select {Entity}.[AccountNumber]

from {Entity}

where {Entity}.[Date]=@CurrDate

group by {Entity}.[AccountNumber]

having COUNT({Entity}.[AccountNumber])>1

Everything that comes out of this is a duplicate under today's date.


Or you can prevent it from ever occuring:

If you right click on the entity, and choose "Edit Entity", you can configure indexes.

If you set the Index to be Unique and add to it only AccountNumber and Date attributes, a pair with the same AccountNumber and Date can't be inserted.

If there are already duplicates, the index creation will fail and you will know.



UserImage.jpg
Anna Dwarika

Hello, 

Thanks for the reply 

I forgot to mention i am using an external database

2023-12-14 09-56-57
Yogesh Javir

Hey,

To check duplicate on list use listany() so based on condition  of date and account number If found any record then its return true else false.

If found and want to remove that particular item from list then use listindexof to find position of current item and then use list remove.

Thanks

Yogesh

UserImage.jpg
Anna Dwarika

Hello,

Do i have to add this within the server action?

2023-12-14 09-56-57
Yogesh Javir

Yea, server action has list function inside system.

Thanks

Yogesh

2024-01-31 05-29-41
Akshay Deshpande

Hello Anna 

you have also try to go for list filter and in condition check for account number and date (server and client action available in system dependency )

And if record is found than its duplicate and if list empty means record is not there 


Thanks and regards,

Akshay Deshpande

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.