Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Validation Rules. Show all posts
Showing posts with label Validation Rules. Show all posts

Thursday 12 January 2017

ADF Basics: Duplicate Record Validation Using Model Level Business Rules

Hello All

Hope you all are doing well :)

When we are creating any data entry form , at that time preventing duplicate entries for some of attributes is very basic validation requirement .

Suppose We are creating a form to make new Departments entry and  there should not be two departments with same name so for this type of validation we need not to write single line of code in Oracle ADF as there are predefined business rules for basic validation

Wednesday 10 September 2014

Dynamic (parameterize) model level validation using message token -Oracle ADF

Hello all
This post falls under ADF Basics category (about a little trick in model layer) but about a common development requirement
How can we create dynamic ADF BC validation ? means it takes a parameter at run time and append it to validation message

Read previous post on model level validation-
Conditional Execution of Model (EO) level Validation- Oracle ADF
ViewObject Validation rules for transient attributes (Model level validation in ADF)

In this post I am using Departments table of oracle HR Schema

  • First step is same , prepare model (EO,VO and AM) using Departments table

  • Creating a business rule that DepartmentName can not be duplicate, for this created a alternate key in EntityObject 

  • Nnow creating unique key business rule for this alternate key and message that appears on validation failure (this is how we apply EO level validations)

  • Run AM and check in BC4J tester, create a new row and on entering duplicate DepartmentName this validation message appears -"Duplicate Department Name"

  • now my requirement is this message should be like - Duplicate Department Name <Administration> , so for this i have to pass parameter in message that shows entered DepartmentName on run-time. ADF provides built in feature to pass tokens in message and on run time it is replace with groovy expression value

  •  On running see desired output

  • to pass more than one parameter just add another token and set groovy for it, see the screens

Thanks - Happy Learning :)

Thursday 17 April 2014

ViewObject Validation rules for transient attributes (Model level validation in ADF)

Hello All,
this post is about model level validation for transient attributes, often we need to apply some common types of validation on transient attributes (as for negative value, for email, for phone number)
in ADF ViewObject there is a editor for validation rules for transient attributes, so now see how to use that editor and rules

  • Create a fusion web application and prepare model layer using Departments table of HR schema

  • Then create a transient attribute in viewObject and you can see that Validation Rules tab appears only in case of transient attribute

  • Now click on add icon to add new validation rule for attribute, you can see there are multiple types for that validation rule 

  • In this post i have used Compare and Regular Expression rules, suppose i have to check that value of transient attribute must not be 100 , so for that rule will be like this, and write a proper message for failure handling 

  • Now run your BC4J tester and check , a window with error message appears there in case of failure

  • You can also check this validation on your page, some more- i have added one more transient field for Email Address and applied a regular expression to validate this field (ADF by default provides regular expression for Email and Phone Number pattern for others you can use your own pattern)

  • After model level configurations , i have dropped Departments ViewObject on page as ADF form, here you can see both validation are working 

Cheers :-) Happy Learning