-----Google Analytics Code Start----> <-----Google Analytics Code Close---->
|Receive Email for New Articles|
|SPEL in OA Framework - With Audio Visual Demo||| Print ||
|Written by Anil Passi|
|Monday, 30 April 2007|
In this article, will learn how SPEL can be used in personalizations.
To begin with we will do some Q & A. This will be followed by some scenarios, and I will then end this training session with an Audio-Visual demo of SPEL.
IMPORTANT:- Please do not jump onto the SPEL Audio-Visual until you have read this article.
Why will I ever use SPEL in OA Framework?
Lets say you wish to hide a field Purchase order buyer using personalization. In order to hide that field, you can simply set the Rendered property of that field to FALSE using personalization. However, what if your requirement is to hide or display this field conditionally? Lets say that you wish to display a Field Named Buyer if and only if the purchase order amount is greater than 4000. This can be achieved using Framework personalization and SPEL.
What is SPEL?
It is an expression that will either return TRUE or FALSE.
If Rendered property of a field in OA Framework is attached to SPEL, then
Field will be displayed if SPEL equates to TRUE
Field will not be displayed if SPEL equates to FALSE.
Properties that can be modified at run time using personalizations ( via spel) are :-
Rendered - To conditionally make a field in OA Framework hidden/displayed
Read Only - To conditionally make a enterable or non-enterable
Required - To make a field mandatory or non-mandatory
Enabled - To conditionally enable or disable that field
Any other properties that can be modified using SPEL?
At the moment OA Framework allows only those set of properties to be alterable via SPEL.
What is the syntax of SPEL?
I think it is better to give examples, rather than provide syntax.
Whatever the syntax is, it must always return a BOOLEAN.
The above expression returns true if user is currently accessing OAF screen from function named IRC_VIS_HOME_SALES_JOBS
Above expression means that, if value of attribute named IsPOGreaterThan4000 is FALSE then, the field will either be disabled or hidden or non-mandatory, depending upon which property this SPEL is attached to.
What if my requirement is to display a field named Buyer Name, if purchase order amount is greater than 4000? Can SPEL be used in this case?
Yes, if there already exists a view object attribute of type BOOLEAN. That view object attribute should have a value of TRUE if purchase order amount is greater than 4000, or else that attribute must have value FALSE.
What if i the VO in question does not already have one such attribute?
You have three options here:-
Option 1. Extend the View Object and add a transient attribute of type Boolean. In the View Object Row Implementation class, inside IsMoreThan4000 return TRUE or FALSE, depending upon the value of the PO Amount field
Option 2. Extend the controller, checking the value of the amount, via VO.
If the amount is greater than 4000, then set the bean rendered property of buyer name field appropriately.
In this training lesson, we will use equivalent of Option 1
CLICK HERE FOR THE AUDIO VISUAL DEMO OF SPEL IN OA FRAMEWORK
written by Suneetha , April 29, 2007
written by Anil Passi , May 04, 2007
written by Mayank , May 04, 2007
written by Mayank , May 07, 2007
written by Anil Passi , May 09, 2007
written by Anil Passi , June 06, 2007
written by Kaustuv Tarai , June 06, 2007
written by SUNDAR , June 25, 2007
written by Anil Passi , June 25, 2007
written by SUNDAR , June 25, 2007
written by SUNDAR , July 02, 2007
written by Sukhjinder , October 12, 2007
How to make a field mandatory or non-mandatory
written by Sai Kumar , November 28, 2007