Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Transient. Show all posts
Showing posts with label Transient. Show all posts

Saturday 11 June 2016

ADF Basics: Use transient attribute to show description of selected value in case of input and combo Lov


In ADF often We apply LOV on a ID attribute to show it's Description to user, This works good in case of choice list (selectOneChoice) but if we use Input Text with List of Values (<af:inputListOfValues>) or Combo Box with List of Values (<af:inputComboboxListOfValues>) then after selection ID appears on page instead of  Description like this


So to avoid this we apply LOV on a transient attribute that shows Description and sets ID value DB attribute, See how to implement this

Tuesday 3 February 2015

ADF Basics: Set multiple LOV's on attribute and conditionally switch using LOV Switcher

This post is about a very basic and common use case
Suppose we have to show different values in our List depending on some condition but all values must be stored in same attribute so for this type of requirement ADF BC framework provides concept of LOV Switcher
Framework allows us to define multiple LOV on same attribute, I hope you all know about defining LOV(List of Values) so move ahead and see how to use lov switcher

 See the implementation part-
  • Created a Fusion Web Application and a viewObject to show LOV on viewport (Used dual to create view object for this example , you can use use your own)





  • Created 2 more viewObject to apply LOV on first viewObject's attribute, One ViewObject is for Departments and other one is for Employees


  • Open dual viewObject select LovAppl attribute and goto ListOfValues tab and add both LOV
    For Department - DepartmentId is List Attribute and DepartmentName will be shown on UI


  • For Employees- EmployeeId is List Attribute and FirstName,LastName will be shown on UI



  • Now click on green plus icon of List Of Values Switcher and add a transient attribute , this will be further used to switch lov on base of some condition


  • So created LovSwitcher attribute , and remember this switcher attribute value should be one of the LOV Name that are applied on attribute.
    Here i am using a condition - if LovType attribute of Dual viewObject is 'D' the LovAppl should show Departments Lov and if it is 'E' then LovAppl should show Employees Lov
    For this i have written expression for lov switcher attribute
    LovType=='D' ? 'LOV_LovAppl' : LovType=='E' ? 'LOV_LovAppl1' : null


  • Now run Application Module and check it


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

Tuesday 17 September 2013

Bug in ADF 11g R2- Transient and Bind Valiable of Timestamp type

This is a bug in ADF 11g R2, and sometimes so much annoying for developer.

Bug Is-

  • Suppose you have created business components for Employees table of HR Schema, there is HireDate in Employees table , see it in EntityObject-

  • Now go to source and see, it is of type oracle.jbo.domain.Timestamp (default java representation of Timestamp database data type )

  • Now go to Employees ViewObject and create a transient variable for DOB(Date Of Birth)  and select it as Timestamp
  •  Now after this if developer tries to get or set value of this transient variable, it shows a exception (java.sql.Timestamp can not be cast to oracle.jbo.domain.Timestamp)



  •  To solve this error go to Employees ViewObject and select transient attribute and go to source, se it is of type java.sql.Timestamp

  • Change it to oracle.jbo.domain.Timestamp  and then run it
  • So this is a bug when developer creates new Transient or Query bind variables of Timestamp type, ADF automatically assign it java.sql.Timestamp
Always check it when using Jdveloper 11gR2

Cheers... happy debugging