0% found this document useful (0 votes)
319 views3 pages

How To Add ViewAttribute in ViewObject (VO) Dynamically

this is to explain how to create an attribute dynamically in VO

Uploaded by

elsa7er2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
319 views3 pages

How To Add ViewAttribute in ViewObject (VO) Dynamically

this is to explain how to create an attribute dynamically in VO

Uploaded by

elsa7er2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Anil'sBlogisBestViewedonGOOGLECHROME

Anil'sOracleApplicationFrameworkBlog
Sharinglearningwithwideraudience
Home

ADF

HowtostartlearningOAF

AboutMe

AnilSharma
Gurgaon,India
Thepoorestpersonisnot
onewithoutmoney,but
onewithoutdreams...

ExtensionsinOAF

Jobs

Saturday,May7,2011

Disclaimer

HowtoaddViewAttributeinViewObject
(VO)dynamically

Theviewsexpressedheredonot
reflecttheviewsofthe
company(ies)Iworkfor(orhave
workedwith)neitherOracle
Corporation's.

Wewerehavingarequirementtoaddacolumninanexistingtableregion
andclientwantstoshowvalueinitbaseduponsomecalculationwith
otherviewattributevalue.

Viewmycompleteprofile

AtthefirstsightwethoughtofextendingtheViewObjectandaddinga
transientattribute.Butthatseemstobeverycomplexprocessasthis
ViewObjectisbasedon5EntityObjects.

Followers

Sowethoughtofsomeworkaroundandcometoasolutionbyaddinga
ViewAttributeinViewObectdynamically.Hereistheapproach

Jointhissite
withGoogleFriendConnect

Members(132) More

Alreadyamember?Signin

FindusonFacebook

OracleAppl
2.8Klikes

LikePage

Bethefirstofyourfriendstolike
this

BlogArchive
2016(2)
2015(1)

WehaveextendedtheControllerandaddaViewAttributedynamicallyin
theViewObjectandcreatedaMessageStyledTextbeanthrough
personalization.

2012(2)
2011(7)

May(1)
Howtoadd
ViewAttribu
tein
ViewObject
(VO)
dynami...
April(1)
March(1)

ContactMe!

Search
//Startingdowhileforsettingvalueinallthetablerow...
do
{
//Doingsomecalculation...
intxxnumber=Integer.parseInt(vo.getCurrentRow().getAttribute("Empno").toString());
doubled=xxnumber*(17.5/100)/2;
StringaString=Double.toString(d);

//SettingthecalculatedderivedvalueinthenewlycreatedVOAttribute
vo.getCurrentRow().setAttribute("XXSalary",aString);
vo.next();
}
while(vo.hasNext());
vo.first();

//FinallyaddingViewAttributeandViewInstancewithMessageTextInputbeanwhichwehavecreatedthroughpersonalizat
OAMessageTextInputBeanmst=(OAMessageTextInputBean)webBean.findChildRecursive("Salary");
mst.setViewUsageName("AllocationsVO1");
mst.setViewAttributeName("XXSalary");
mst.setReadOnly(true);
}

Thanks
Anil

August(1)
June(3)

ContactMe

SelectLanguage
publicvoidprocessRequest(OAPageContextpageContext,OAWebBeanwebBean)
Poweredby
Translate
{
super.processRequest(pageContext,webBean);
OAApplicationModuleam=(OAApplicationModule)pageContext.getApplicationModule(webBean);
OAViewObjectvo=(OAViewObject)am.findViewObject("AllocationsVO1");Search1
if(vo!=null)
{
Go
vo.addDynamicAttribute("XXSalary");//AddingViewAttributetoVO
}
vo.reset();
Search2
vo.next();

2014(6)
2013(5)

Theopinionsexpressedby
visitorsonthisblogaretheirs.
Youarefreetousethis
informationandIamnot
responsibleifyoueverhappento
sufferaloss/
inconvenience/damageusingit.

PostedbyAnilSharmaat1:00AM
Reactions:

(funny (0

(interesting (0

(cool (0

10comments:
Anonymous May10,2011at8:08AM
HiAnil,
Thanksforsuchawonderfularticle.Iusedthiscodetoday.First
time the output comes properly (data shows up in

2010(24)
2009(44)

messageStyleText). from second time it throws an error


"oracle.jbo.NameClashException: JBO25001: Name ExpAcct of
object type Attribute already exists". Any idea why it comes,
pleaseletmeknow.
Reply

PopularPosts
HowtoaddViewAttribute
inViewObject(VO)
dynamically
ControllerExtensionin
R12OAF
ImportantProfileOptions
inOAF
DependentLOVinOAF
AdvancedTablein
AdvancedTableviaView
Link
EObasedVOExtension
inOAFR12
PartialPageRendering
(PPR)
ToFindouttheevent
Occur
HowtoTestorCreate
DBCFileonOracleApps
11.5.10
SubmittingthePageon
EnterKeyOAF

Anonymous May25,2011at5:56AM
PleaseHelpmeEvenIamalsofacingthesameproblem
Reply

Anonymous May25,2011at6:15AM
Hi,
In above IF condition i.e. if (vo != null), handle the exception by
usingtry..catchblockasshownbelow:
try
{
Stringl_att=vo.findAttributeDef("XXSalary").toString()
}
catch(Exceptionexception)
{
vo.addDynamicAttribute("XXSalary") //Adding ViewAttribute to
VO
}
L.Nishanth,AppsAssociates
Reply

AnilSharma May26,2011at12:37AM
ThanksNishanthforyourinput.Yes,Imistakenlyforgettocheck
that while adding dynamic attribute we have to check its
existencefirst.
Thanks
Anil

LiveTrafficFeed
AvisitorfromPlymouth,
Minnesotaviewed"Anil's
OracleApplicationFramework
Blog:PopupinOAFR12.1.2
AvisitorfromUnitedStates
PartII"36minsago
viewed"Anil'sOracle
ApplicationFrameworkBlog:
AdvancedTableinAdvanced
TableviaViewLink"42mins
AvisitorfromRockville,
ago
Marylandviewed"Anil'sOracle
ApplicationFrameworkBlog:
April2009"1hr53minsago
AvisitorfromPeoria,Illinois
viewed"Anil'sOracle
ApplicationFrameworkBlog:
CreatingVOatRunTimein
ControllerORDynamically
AvisitorfromSecaucus,New
createdVO"2hrsago
Jerseyviewed"Anil'sOracle
ApplicationFrameworkBlog:
FindDuplicateRowOR
Copy/CloneVORow"2hrs4
AvisitorfromFlint,Michigan
minsago
viewed"Anil'sOracle
ApplicationFrameworkBlog:
HowdoIfindrowsthatwere
selectedbythetableselector"2
AvisitorfromOmanviewed
hrs12minsago
"Anil'sOracleApplication
FrameworkBlog:Find
DuplicateRowORCopy/Clone
AvisitorfromBrookPark,Ohio
VORow"2hrs17minsago
viewed"Anil'sOracle
ApplicationFrameworkBlog:
Getting&SettingValue"2hrs
AvisitorfromIndiaviewed
28minsago
"Anil'sOracleApplication
FrameworkBlog:CompareVO
rowwithDatabaserowOAF"
AvisitorfromComayagua
2hrs37minsago
viewed"Anil'sOracle
ApplicationFrameworkBlog:
HowtoaddViewAttributein
ViewObject(VO)dynamically"
RealtimeviewGetFeedjit

Reply

AnilSharma May26,2011at12:38AM

OurNewADFFacebookPage

Hereiswhatdevguidesaysaboutit:
//Checkwhethertheattributewiththesamenameexistsornot.
//Notethatforattributes,weneedtousetrycatchclause.
If(vo.lookupAttributeDef("MyAttr")==null)
{
vo.addDynamicAttribute("MyAttr")
}
Reply

ADF(Applic
1.6Klikes

LikePage

Bethefirstofyourfriendstolike
this

Anonymous May26,2011at4:43AM
HiAnil,
Iusedyourcodetochecktheexistenceofattribute.

Visitorstothispage
If(vo.lookupAttributeDef("MyAttr")==null)
{
vo.addDynamicAttribute("MyAttr")
}
InmycaseItisthrowingOAexception.
WhenItriedwithNishanth'ssolutionitisworkingfine.
Thankyou,
Keshav
Reply

Labels

ADF (2) AppsLocalLogin (1) Array (1)


AnilSharma

May26,2011at10:33PM

Keshav,
PleasereadmyreplyproperlyyouhavetousethisinTrycatch
block.....
Reply

Attribute (1)

Bean (3)

Calling

PLSQL from OAF (1) Cone VO Row (1)


Convertstringtodate(1)CopyVORow(1)
customtable(1)DFF(2)Event(1)Find
Duplicate Row (1) FireAction (1)
FirePartialAction (1) Hello World (1) Key
Flexfield(1)KFF(1)LoginPage(1)OAF(1)
Objecttype(1) Page (1) Patch (1) PLSQL

(1)R12.2.4 (1) Read only (1) readonly (1)


Restricted Access (1) segment (1) table
type(1)WHOColoums(1)Whole(1)

Salah May28,2011at4:44PM
greatadditioninmyknowledgeAnil
Reply

Musthavebooks
Anonymous October21,2011at1:49AM
reallyitisaniceexample|
Reply

sudhir November17,2011at9:11PM
HiAnilit'sverygoodpostsoinformative.

OracleMobile
Application...

IfpossibleIneedyourhelp,
ScenariocomesunderOAFExtensions.
user would enter data on 2 fields on say page x and I need to
displaythatdataonsaypagezsoforthatIneedtocreatethose
fields.ButthenhowtohandleVO??
Howtoachievethistask??

$45.62
Shopnow

[email protected]
Pleasegiveyourvaluablewordings
Reply
QuickStart
Guideto...
$24.04

Enteryourcomment...

Shopnow

Commentas:

Publish

GoogleAccount

Preview

OracleE
Business...
$46.59
Shopnow

Note:Onlyamemberofthisblogmaypostacomment.

Linkstothispost
CreateaLink

NewerPost

Home

OlderPost

Subscribeto:PostComments(Atom)

CopyRestricted

Ads

Copyright2010Anil'sBlog.Allrightsreserved..AwesomeInc.template.PoweredbyBlogger.

You might also like