14 Replies Latest reply on Sep 18, 2009 1:55 PM by Sireesha Pinninti-Oracle

    Inserting  values  from another table depending on selected value from LOV

    662340
      I am using the jdeveloper 11.1.1.1.0 version.
      i have one table 'ITP_database' having columns Appid,database_name,database_type,size,servername ,health status.
      here 'database_name' column is LOV.(LOV values are populating from the view object created from the itp_database_default tabel)
      another table itp_database_default having all the columns except one column "APPID" in ITP_database.

      when trying to insert new rows in to ITP_database ,always we have to give appid as 'appid12' and next when we select the 'databse name' from the LOV ,the remainig columns must be defaulty selected from the ITP_DAtabase_default table corresponding to the selected database name.
      my requirement is when trying to insert values in to ITP_database , the values for the columns should be populated automatically from ITP_database_default depending on the value selected from the LOV for the column datbase_name .


      How is it possible.what ar ethe steps do i need to follow.
      Please guide me.


      Sailaja
        • 1. Re: Inserting  values  from another table depending on selected value from LOV
          Sireesha Pinninti-Oracle
          Sailaja,

          The easiest way is to set groovy expressions for each dependent attribute in the view object based on ITP_database as below:

          For database_type:

          - Edit the attribute, select Expression and provide the below value:
          viewObject.getApplicationModule().findViewObject("<View_Object_name_for_ITP_DAtabase_default_As_Apeared_In_DC>").getFilteredRows("<Attribute_Name_for_database_name>",<Attribute_Name_for_database_name>)[0].getAttribute("<Attribute_Name_for_database_type>")
          
          Sample code to assing Dname based on Deptno value is:
          viewObject.getApplicationModule().findViewObject("DeptView1").getFilteredRows("Deptno",Deptno)[0].getAttribute("Dname")
          - Repeat the same for all other attributes(make sure that you give correct attribute for getAttribute method)

          - Finally, set autoSubmit property to true on the LOV and partialTriggers property of all dependent fields to LOV_ID

          Other way to do is manually write code in returnListener to filter the data based on selected database_name and then assigning values to dependent fields

          Sireesha
          • 2. Re: Inserting  values  from another table depending on selected value from LOV
            662340
            Sireesha,

            I followed your steps.i edit the DbType attribute of ItpDatabaseView to expression as below:
            viewObject.getApplicationModule().findViewObject("ItpDatabaseDefView1").getFilteredRows("DbName",DbName)[0].getAttribute("DbType").
            NExt i set the inputtext fileld of the DbType attribute partial trigger property to LOVID.

            when runnig the application on clicking createinsert button ,i am getting the following error:


            Messages for this page are listed below.
            Error     
            Unexpected exception caught: java.lang.ArrayIndexOutOfBoundsException, msg=0
            Error     
            0
            And my server Log is:
            WARNING: ADF: Adding the following JSF error message: Unexpected exception caught: java.lang.ArrayIndexOutOfBoundsException, msg=0
            oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.ArrayIndexOutOfBoundsException, msg=0
                 at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:778)
                 at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:807)
                 at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:711)
                 at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1889)
                 at oracle.jbo.server.ViewRowStorage.initDefaultExpressionAttributes(ViewRowStorage.java:917)
                 at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1141)
                 at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:415)
                 at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:432)
                 at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:4679)
                 at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1818)
                 at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2211)
                 at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2257)
                 at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2233)
                 at oracle.jbo.server.ViewObjectImpl.createRow(ViewObjectImpl.java:9404)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1223)
                 at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2120)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:693)
                 at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:217)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:176)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
                 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
                 at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
                 at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1245)
                 at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
                 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
                 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:673)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
                 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
                 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
                 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
                 at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
                 at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
                 at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
                 at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
                 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
                 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
                 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
                 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
            Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
                 at org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayGetAtMetaMethod.invoke(ObjectArrayGetAtMetaMethod.java:38)
                 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.invoke(PojoMetaMethodSite.java:47)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
                 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
                 at Script1.run(Script1.groovy:1)
                 at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:766)
                 ... 68 more
            ## Detail 0 ##
            java.lang.ArrayIndexOutOfBoundsException: 0
                 at org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayGetAtMetaMethod.invoke(ObjectArrayGetAtMetaMethod.java:38)
                 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.invoke(PojoMetaMethodSite.java:47)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
                 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
                 at Script1.run(Script1.groovy:1)
                 at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:766)
                 at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:807)
                 at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:711)
                 at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1889)
                 at oracle.jbo.server.ViewRowStorage.initDefaultExpressionAttributes(ViewRowStorage.java:917)
                 at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1141)
                 at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:415)
                 at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:432)
                 at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:4679)
                 at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1818)
                 at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2211)
                 at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2257)
                 at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2233)
                 at oracle.jbo.server.ViewObjectImpl.createRow(ViewObjectImpl.java:9404)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1223)
                 at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2120)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:693)
                 at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:217)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:176)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
                 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
                 at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
                 at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1245)
                 at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
                 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
                 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:673)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
                 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
                 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
                 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
                 at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
                 at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
                 at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
                 at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
                 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
                 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
                 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
                 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
            Sep 16, 2009 10:01:21 AM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
            WARNING: ADF: Adding the following JSF error message: 0
            java.lang.ArrayIndexOutOfBoundsException: 0
                 at org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayGetAtMetaMethod.invoke(ObjectArrayGetAtMetaMethod.java:38)
                 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.invoke(PojoMetaMethodSite.java:47)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
                 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
                 at Script1.run(Script1.groovy:1)
                 at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:766)
                 at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:807)
                 at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:711)
                 at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1889)
                 at oracle.jbo.server.ViewRowStorage.initDefaultExpressionAttributes(ViewRowStorage.java:917)
                 at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1141)
                 at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:415)
                 at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:432)
                 at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:4679)
                 at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1818)
                 at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2211)
                 at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2257)
                 at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2233)
                 at oracle.jbo.server.ViewObjectImpl.createRow(ViewObjectImpl.java:9404)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1223)
                 at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2120)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:693)
                 at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:217)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:176)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
                 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
                 at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
                 at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1245)
                 at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
                 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
                 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:673)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
                 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
                 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
                 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
                 at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
                 at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
                 at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
                 at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
                 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
                 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
                 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
                 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
            Sep 16, 2009 10:01:21 AM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
            WARNING: ADF: Adding the following JSF error message: 0
            java.lang.ArrayIndexOutOfBoundsException: 0
                 at org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayGetAtMetaMethod.invoke(ObjectArrayGetAtMetaMethod.java:38)
                 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.invoke(PojoMetaMethodSite.java:47)
                 at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
                 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
                 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
                 at Script1.run(Script1.groovy:1)
                 at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:766)
                 at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:807)
                 at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:711)
                 at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1889)
                 at oracle.jbo.server.ViewRowStorage.initDefaultExpressionAttributes(ViewRowStorage.java:917)
                 at oracle.jbo.server.ViewRowStorage.create(ViewRowStorage.java:1141)
                 at oracle.jbo.server.ViewRowImpl.create(ViewRowImpl.java:415)
                 at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:432)
                 at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:4679)
                 at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1818)
                 at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2211)
                 at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2257)
                 at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2233)
                 at oracle.jbo.server.ViewObjectImpl.createRow(ViewObjectImpl.java:9404)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1223)
                 at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2120)
                 at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:693)
                 at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:217)
                 at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:176)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
                 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
                 at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
                 at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1245)
                 at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
                 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
                 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:673)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
                 at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
                 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
                 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
                 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
                 at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
                 at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
                 at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
                 at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
                 at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
                 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
                 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
                 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
                 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
            Sep 16, 2009 10:01:22 AM oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding getInputValue
            WARNING: ADFv: Could not find selected item matching value oracle of type: java.lang.String in the list-of-values.
            Sep 16, 2009 10:01:22 AM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
            WARNING: ADF: Adding the following JSF error message: Unexpected exception caught: java.lang.ArrayIndexOutOfBoundsException, msg=0
            • 3. Re: Inserting  values  from another table depending on selected value from LOV
              Sireesha Pinninti-Oracle
              Sailaja,

              Do you have atleast one matching record for the current DBname?

              Sireesha
              • 4. Re: Inserting  values  from another table depending on selected value from LOV
                662340
                Sireesha,


                I have three rows in ItpDAtabaseDefault table.
                IN ItpDatabase table i have 1 row matching to one of the row of ItpDatabaseDefault table(in this row the Dbname is same as one of the Dbname of Itpdatabasedefault table).
                how can i resolve the error.

                sailaja
                • 5. Re: Inserting  values  from another table depending on selected value from LOV
                  Sireesha Pinninti-Oracle
                  Sailaja,

                  You can use the above suggested groovy expression method only if you have matching records for all the rows in ItpDatabaseDefView1 or else it gives ArrayIndexOutOfBoundsException.
                  If you are sure that you can't have matching records for all the rows in the parent table, then you can use ValueChangeListener method to populate the values to ITP_database from ITP_DAtabase_default table.
                  To do this:

                  - Write one method in AMImpl which takes current selected database name as parameter and filters the rows in default view and then assign to the current row of the itpdatabase view
                  Sample code:
                  public void assignDefaultValuesByDBName(String dbName){
                      Row[] rows = this.getItpDatabaseDefView1().getFilteredRows("DbName",dbName);
                      if(rows != null && rows.length >0){
                         Row defaultRow = rows[0];
                         // get Base View Object and get the current row and assingn values to each attribute using setAttribute
                         //<ItpDataBaseViewCurrentRow>.setAttribute("DbType",defaultRow .getAttribute("dbType")) etc...
                      }
                  }
                  - Expose this method to the client interface and add the methodaction binding
                  - Inside valueChangeListener method call the AM method using OperationBinding. You can see sample code on how to pass value to AMmethod in [ this post|http://forums.oracle.com/forums/thread.jspa?threadID=953035&tstart=15]
                  - Finally, refresh the fields

                  Hope it is clear
                  Sireesha

                  Edited by: Sireesha Pinninti on Sep 16, 2009 9:11 AM
                  1 person found this helpful
                  • 6. Re: Inserting  values  from another table depending on selected value from LOV
                    662340
                    Sireesha,


                    I added the valueChangeListener method 'vclofsoc' in Managed Bean for LOV component .
                    IN this method i am getting the selcted value from the LOV and the correspoding row for this in ItpDatabaseDefView1 into 'row1'.
                    next i am trying to set the attribute DbSize of ItpDatabaseView1 from the 'row1'.


                    --------------------------------------------------------------------------------
                    public void vclofsoc(ValueChangeEvent valueChangeEvent) {
                    // Add event code here...
                    System.out.println("Inside VCL Method:");

                    int rangeIndex = (Integer)valueChangeEvent.getNewValue();
                    System.out.println("rangeIndex--------->"+rangeIndex);
                    // new value only gives you the index
                    DCIteratorBinding regionsIter =
                    getItrtBindings("LOV_databaseNameVO1Iterator");
                    Row row = regionsIter.getRowAtRangeIndex(rangeIndex);

                    String dbname = (String)row.getAttribute("DbName");

                    System.out.println(" Db Name:" + dbname);//returns the Dbname the user selected from LOV


                    ApplicationModule am = Configuration.createRootApplicationModule("model.AppModule","AppModuleLocal"); //
                    ViewObject vo = am.findViewObject("ItpDatabaseDefView1"); // to find login view
                    ViewObject vo1= am.findViewObject("ItpDatabaseView1");

                    vo.setWhereClause("DB_NAME=:1");
                    vo.setWhereClauseParam( 0,dbname);
                    vo.executeQuery();

                    Row row1;
                    row1 = vo.next();
                    String strdbsize=row1.getAttribute("DbSize").toString();
                    System.out.println("DB size : ",strdbsize);

                    vo1.getCurrentRow().setAttribute("DbSize",strdbsize);//line number 63

                    }
                    -------------------------------------------------------------------------------
                    while running i am able to print the Db Size .but i am getting the NUllpointer Exception at the line :

                    vo1.getCurrentRow().setAttribute("DbSize",strdbsize);

                    Can you pls tell me why i am getting this error.

                    My error log is:
                    ------------------------------------------------------------------------------------------------------

                    Sep 16, 2009 8:48:53 PM oracle.jbo.uicli.mom.CpxUtils$Visitor logMainApplicationCpx
                    INFO: file:/C:/Documents and Settings/Administrator/Application Data/JDeveloper/system11.1.1.1.33.54.07/o.j2ee/drs/practiceAPP1/practiceAPP1-ViewController-webapp/WEB-INF/classes/view/DataBindings.cpx
                    Sep 16, 2009 8:48:54 PM oracle.adfinternal.controller.faces.lifecycle.JSFLifecycleImpl setLifecycleContextBuilder
                    INFO: ADFc: Initializing ADF Page Lifecycle for the JSF environment, LifecycleContextBuilder is 'oracle.adfinternal.controller.application.model.JSFDataBindingLifecycleContextBuilder'.
                    Sep 16, 2009 8:49:02 PM oracle.adf.share.jndi.MDSBackingStore isReadOnlyMDSStore
                    INFO: Read only backing store
                    Inside VCL Method:
                    rangeIndex--------->1
                    Db Name:db2
                    DB size :30MB
                    Sep 16, 2009 8:49:13 PM oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator handleError
                    SEVERE: Server Exception during PPR, #1
                    javax.servlet.ServletException
                         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
                         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
                         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
                         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
                         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
                         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
                         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
                         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
                         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
                         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
                         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
                         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
                         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                         at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
                         at java.security.AccessController.doPrivileged(Native Method)
                         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
                         at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
                         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
                         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
                         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
                         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
                         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
                         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
                         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
                         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
                         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
                    Caused by: java.lang.NullPointerException
                         at Managedbean1.vclofsoc(Managedbean1.java:63)
                         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                         at java.lang.reflect.Method.invoke(Method.java:597)
                         at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
                         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
                         at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
                         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1245)
                         at org.apache.myfaces.trinidad.component.UIXEditableValue.broadcast(UIXEditableValue.java:214)
                         at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:147)
                         at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:271)
                         at oracle.adf.view.rich.component.UIXTable.broadcast(UIXTable.java:140)
                         at oracle.adf.view.rich.component.rich.data.RichTable.broadcast(RichTable.java:364)
                         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:787)
                         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:324)
                         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
                         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                         ... 34 more

                    ---------------------------------------------------------------------------------------------------------


                    Sailaja
                    • 7. Re: Inserting  values  from another table depending on selected value from LOV
                      Sireesha Pinninti-Oracle
                      Sailaja,

                      Problem is not with the dbSize, instead it is with the vo.getCurrentRow() which was coming as null. It is because of using createRootApplicationModule method to get the application module which creates new application module instance so you don't have access to the current view object state. Instead get the application module using the method suggested by Timo(which was marked as correct answer) in [this post|http://forums.oracle.com/forums/thread.jspa?threadID=933022] and pass your AppModuleDataControl name(which you see under datacontrol palette) as parameter to the getApplicationModuleForDataControl method to get the correct appmodule.

                      But, I suggest you to write the model code in AMImpl and call it from valueChangeListener. You can get the sample code from [this post|http://forums.oracle.com/forums/thread.jspa?threadID=953035&tstart=15] on how to do.

                      Sireesha
                      1 person found this helpful
                      • 8. Re: Inserting  values  from another table depending on selected value from LOV
                        662340
                        Sireesha,


                        Now i got my requirement.
                        THank you for guiding me in this process.
                        I just change code to use iterator to get current row.now it is working.

                        ------------------------------------------------------------------------------------------------------------------------------
                        public void vclofsoc(ValueChangeEvent valueChangeEvent) {
                        // Add event code here...
                        System.out.println("Inside VCL Method:");

                        int rangeIndex = (Integer)valueChangeEvent.getNewValue();
                        System.out.println("rangeIndex--------->"+rangeIndex);
                        // new value only gives you the index
                        DCIteratorBinding regionsIter =
                        getItrtBindings("LOV_databaseNameVO1Iterator");
                        Row row = regionsIter.getRowAtRangeIndex(rangeIndex);

                        String dbname = (String)row.getAttribute("DbName");

                        System.out.println(" Db Name:" + dbname);//returns the Dbname the user selected from LOV


                        ApplicationModule am = Configuration.createRootApplicationModule("model.AppModule","AppModuleLocal"); //
                        ViewObject vo = am.findViewObject("ItpDatabaseDefView1");
                        // ViewObject vo1= am.findViewObject("ItpDatabaseView1");


                        vo.setWhereClause("DB_NAME=:1");
                        vo.setWhereClauseParam( 0,dbname);
                        vo.executeQuery();

                        Row row1;
                        row1 = vo.next();
                        String strdbsize=row1.getAttribute("DbSize").toString();
                        System.out.println(strdbsize);


                        DCIteratorBinding itpdbv1itr = getItrtBindings("ItpDatabaseView1Iterator");
                        Row r1= itpdbv1itr.getCurrentRow();
                        r1.setAttribute("DbSize",strdbsize);
                        // vo1.getCurrentRow().setAttribute("DbSize",strdbsize);

                        ----------------------------------------------------------------------------------------


                        Sailaja
                        • 9. Re: Inserting  values  from another table depending on selected value from LOV
                          Sireesha Pinninti-Oracle
                          Sailaja, Nice to see your requirement wokring, can you please mark the thread as answered.
                          Sireeesha
                          • 10. Re: Inserting  values  from another table depending on selected value from LOV
                            662340
                            Sireesha,


                            My code is not working when i selected the row selection option while dragging the ITPDatabaseview object as ADF TABle on to the page.
                            previously i didn't select this option.that time when i select the dbname from lov, the dbsize is populated .

                            This time i selected the rowselection option while dragging table.during the runtime when i select the value from lov to dbname,dbsize is not populated.
                            The last line is not working here.i am not able to set the attribute.

                            //r1.setAttribute("DbSize",strdbsize); //

                            Can you guess why i am not able to set the attribute.

                            Sailaja
                            • 11. Re: Inserting  values  from another table depending on selected value from LOV
                              Sireesha Pinninti-Oracle
                              Sailaja,

                              RowSelection should not be a problem, here are few questions to answer your questions:

                              - Is your valueChangeListener method getting called on selecting the Dbname from the lov?(If not, have you set autosubmit to true)
                              - Is Only the last statement not getting called? If so, check the iterator name(ItpDatabaseView1Iterator) given to getItrtBindings method is correct or not
                              - If the iterator name is correct, then check itpdbv1itr.getCurrentRow() is returning current row or not by just printing some property(like appid)
                              - If all the above setup is correct, then it should set the value correctly

                              I mainly guess the problem was due to the second point.

                              Sireesha
                              • 12. Re: Inserting  values  from another table depending on selected value from LOV
                                662340
                                Sirieesha,


                                I set the autosubmit property to true.
                                and i gave the iterator name correctly.
                                and my VCL method also getting called on selection of LOV.
                                here i am providing the code:
                                ---------------------------------------------------
                                public void vclofsoc(ValueChangeEvent valueChangeEvent) {
                                // Add event code here...
                                System.out.println("Inside VCL Method:");
                                int rangeIndex = (Integer)valueChangeEvent.getNewValue();
                                System.out.println("rangeIndex--------->"+ rangeIndex);
                                // new value only gives you the index
                                DCIteratorBinding regionsIter = getItrtBindings("LOV_databaseNameVO1Iterator");
                                Row row = regionsIter.getRowAtRangeIndex(rangeIndex);

                                String dbname = (String)row.getAttribute("DbName");

                                System.out.println(" Db Name:" + dbname);//returns the Dbname the user selected from LOV
                                ApplicationModule am = Configuration.createRootApplicationModule("model.AppModule","AppModuleLocal"); //
                                ViewObject vo = am.findViewObject("ItpDatabaseDefView1");
                                // ViewObject vo1= am.findViewObject("ItpDatabaseView1");


                                vo.setWhereClause("DB_NAME=:1");
                                vo.setWhereClauseParam( 0,dbname);
                                vo.executeQuery();

                                Row row1;
                                row1 = vo.next();
                                String strdbsize=row1.getAttribute("DbSize").toString();
                                System.out.println(strdbsize);


                                DCIteratorBinding itpdbv1itr = getItrtBindings("ItpDatabaseView1Iterator");
                                Row r1= itpdbv1itr.getCurrentRow();

                                //r1.setAttribute("DbSize",strdbsize);
                                System.out.println("Current row: "+itpdbv1itr.getCurrentRow().toString());
                                itpdbv1itr.getCurrentRow().setAttribute("DbSize",strdbsize);

                                }
                                ------------------------------------------------------------------------

                                my server LOg:

                                --------------------------------------
                                INFO: Read only backing store
                                Inside VCL Method:
                                rangeIndex--------->1
                                Db Name:db2
                                30MB
                                Current row: ViewRow [oracle.jbo.Key[590923 ]]
                                ------------------------------------------

                                Can you check it once and tell me why i am not able to setAttribute .




                                Sailaja
                                • 13. Re: Inserting  values  from another table depending on selected value from LOV
                                  Sireesha Pinninti-Oracle
                                  Sailaja,

                                  The field was not refreshing because you were creating new application module instance(using createRootApplicationModule) which doesn't hold the current state of the iterator.

                                  See this below reply copied from my previous post which gives a link to some other post which explains the way to getApplicationModule instance

                                  --------

                                  It is because of using createRootApplicationModule method to get the application module which creates new application module instance so you don't have access to the current view object state. Instead get the application module using the method suggested by Timo(which was marked as correct answer) in [this post|http://forums.oracle.com/forums/thread.jspa?threadID=933022] and pass your AppModuleDataControl name(which you see under datacontrol palette) as parameter to the getApplicationModuleForDataControl method to get the correct appmodule.

                                  But, I suggest you to write the model code in AMImpl and call it from valueChangeListener. You can get the sample code from this post on how to do.
                                  ----------

                                  Sireesha

                                  Edited by: Sireesha Pinninti on Sep 18, 2009 6:52 AM
                                  • 14. Re: Inserting  values  from another table depending on selected value from LOV
                                    Sireesha Pinninti-Oracle
                                    If it still doesn't work, can you surround the entire method code with try and catch block and see if you are getting any exceptions

                                    Sireesha