Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Temporarily ignore validations on oj-input-date

ZacDNov 10 2021

Hello,
Using JET 9.2.0 here. We have a scenario where we are intercepting a user keyboard event. We want to set the focus on an oj-input-date and also set the initial value to the key that the user pressed. The problem I'm seeing is that the single character value does not constitute a valid date, so an oj.ConverterError exception is getting thrown. This also causes the UI to display an error message to the user.
image.pngIs there any way that I can programmatically set the value of a JET component without it triggering the validations? Or possibly some way I can clear the error messages? I tried using reset(), but it just caused the error to get thrown again, as the value was still not valid.
Here's what I'm doing in the JavaScript right now, for reference:

this.eInput.focus();
try {
    this.eInput.setProperty('value', this.value); //throws oj.ConverterError
} catch (e) {
    console.warn(e);
    //this.eInput.reset(); //throws oj.ConverterError again if uncommented
}

Comments

Timo Hahn
Answer

This should be done in the DB to avoid wrong data in the db. There you can add a check constraint to check if a record matches your criteria the throw a DB error. This error is picked up from the framework and published to the UI.
Another method would be to do this in java. Here you can add a business logic and check the criteria. See
Developing Fusion Web Applications with Oracle Application Development Framework (0 Bytes)Timo

Marked as Answer by User_7TK0D · Sep 2 2022
dvohra21

You can create an Alternate Key Constraint on the EO and then use the UniqueKey Validation to validate the key value at commit time. Detail at https://docs.oracle.com/middleware/12212/adf/develop/GUID-92542726-9FC2-435D-8BAC-F140CB0DC579.htm#ADFFD413

User_7TK0D

@dvohra21
May I ask why my alt keys is null?
image.png

dvohra21

Could be because an Alternate Key is not defined. Is an Alt Key defined? Please refer https://docs.oracle.com/middleware/12212/adf/develop/GUID-631716A4-95D2-41A0-A56B-FB168F5268AA.htm#ADFFD212

User_7TK0D

@dvohra21
Hello, I already added the Alternate Key and selected the UniqueKey Validation. But how can i put validation if the status is NEW/PENDING with same person number and cycle, it will throw an error or else it will insert only if the status is already set to PROCESSED

dvohra21

Since creating an alternate key essentially creates indexing on the table in the database. It will fail if duplicate records are already there**.** To remove duplicates either use advanced find to manually delete or update records or duplicate detection job to delete the record. This usually happens when multiple records exist that have the same combined alternate key in the target system. Run an advanced find for the fields that make up the alternate key on the entity in question and I'm sure you will find duplicate results. Changing the values of one of those duplicate records (across every pair of duplicates) will allow the key to be created once there are no duplicates.

User_7TK0D

@timo-hahn1 @dvohra21
Thanks for your help. I used the method validator for validating the ADF table.

1 - 7

Post Details

Added on Nov 10 2021
9 comments
161 views