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
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.
Hello,
Thanks for the reply
I forgot to mention i am using an external database
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
Do i have to add this within the server action?
Yea, server action has list function inside system.
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