Skip to main content

We have a requirement that we need to check the duplicate entries in the list which has Add toolbar button and Delete toolbar button which is used to add and delete the entries to the list.On double click of the selected item in the list we can edit the same.

When we click on add,the data doesnot go to the database,it goes when we click on the other button which at form level.so we are unable to check the duplicate entries made to the list before it goes to the DB.

Can someone suggest what can be done to check the duplicate entries made before entering it to the DB.

 

I have attached few snapshots which can provide a picture of our requirements.

 

Thanks 

Vishal


11949i3CAB3A971E58E196.png
14726iD2BF173703147BE5.png

Hi Vishal

 

I don't believe there is currently a way to implement this requirement in smartforms. I understand there is some "For each" rule functionality planned for future releases that may allow you to check for duplicates before committing to the database.

 

Can I suggest you look at implementing this business logic at the database layer. You could create a stored procedure that checks for any duplicates and map this to the create method for the SmartObject. The downside of this approach is that you can’t check for duplicates before the user commits (i.e. click Save) and therefore you can't notify the user of duplicates, and stop the save, before committing the data.

 

You could perhaps create a new smartobject method that  saves the list data to a temporary/staging table first when the user clicks save. You could then call another method that performs a duplicate test, and returns a result (e.g. true/false to indicate duplicates) to the smartform to indicate if duplicates are present. If they are present you can stop the actual save (using rule conditions) and alert the user. If they are not present then you can proceed with the save (or call a method to just insert the data from the temporary/staging table into the destination table).


http://community.k2.com/t5/K2-blackpearl/How-to-validate-for-duplicate-row-entry-on-a-list-view/ta-p/86291 


Reply