Tuesday, 12 December 2017

Interactive grid validation

APEX and IG validation

 

Interactive grid validation


Check for duplicates


Something that come out today as a question - How to validate Interactive grid to check if your user typed primary key like EMPNO is not already in the table?  

Catch was to do this only on insert as people will not be able to delete or update it afterwards.

Adding a validation to your IG is easy enough, creating one as:

 
 
Where PLSQL Function body code is:



That is all. Notice the use of APEX$ROW_STATUS to detect if row is created.






Happy APEXing,
Lino

7 comments:

  1. Thank you this was helpfull

    ReplyDelete
  2. If a user select two duplicates values without saving it does not work???

    ReplyDelete
  3. Is there a way to use APEX_$ROW_STATUS is JS? If the row status is update I need to set the values of WHO_UPDATED column, if the status is create I need to set the value of WHO_CREATED column.

    ReplyDelete
  4. Hi SLino,
    Thanks for the clear explanation.
    I tried this but this is not covering the case where the user enters the duplicates within the new(now adding) rows.

    Is there a way to do this.

    ReplyDelete
  5. @Sunny, I've been trying to find the exact same IG Client side validation solution but no cigar. For new and updated rows (C and U), its fairly easy to validate against already submitted data. I'm guessing JS with for example "onBlur" with loop on records with rowstatus C and U. I'm just not that good in JavaScript.
    @SLino, any idea how to validate against nonsubmitted rows?

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Fab. Just what I needed. Thanks very much.

    ReplyDelete