5 Replies Latest reply on Jul 16, 2019 2:38 PM by 3803247

    how to pass % in OAF if statement

    3803247

      How to pass %ABC% in If statement in OAF controller.

       

      Example

      if("MINIMUM_ORDER_QUANTITY".equals(aValue))

       

      %MINIMUM_ORDER%

        • 1. Re: how to pass % in OAF if statement
          Dmitry B.

          Please try to use: if(aValue.contains("MINIMUM_ORDER"))

          • 2. Re: how to pass % in OAF if statement
            3803247

            Does it will work like SQL 'LIKE' statement..

            I mean %MINIMUM_ORDER%

            • 3. Re: how to pass % in OAF if statement
              3803247

              Hi,

               

              Getting null pointer exception

               

                        if(aValue.contains("Price_Break"))

                          {

                          if(bValue.equals("0")) -- line number 63(null pointer exception)

                          {

                            throw new OAException("Attribute Name :  " +aValue+  "  should be Greater than Zero",OAException.ERROR);

                          }

                          }

               

               

              Exception.

               

              oracle.apps.fnd.framework.OAException: java.lang.NullPointerException

              at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:896)

              at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1169)

              at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1435)

              at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2850)

              at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1838)

              at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:536)

              at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:424)

              at _OA._jspService(_OA.java:204)

              at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)

              at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)

              at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)

              at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

              at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)

              at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)

              at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)

              at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)

              at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)

              at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)

              at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)

              at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)

              at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)

              at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)

              at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)

              at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)

              at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)

              at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)

              at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)

              at java.lang.Thread.run(Thread.java:595)

              ## Detail 0 ##

              java.lang.NullPointerException

              at xxosk.oracle.apps.pon.response.creation.webui.xxoskResponseItemDetailsCO.processFormRequest(xxoskResponseItemDetailsCO.java:63)

              • 4. Re: how to pass % in OAF if statement
                Orcl1512

                check what value is getting stored in bValue.

                also good way is to test for not null every time. it avoids the occurrence of null pointer exception

                • 5. Re: how to pass % in OAF if statement
                  3803247

                  I have rectified the issue by converting String to number.

                  But again getting the same error when doing up sum(bValue)\\

                   

                  Please check and do needful.

                  Also is it possible to restrict decimal numbers from the user entered field from the bValue..

                   

                  Our requirement is If AttributeName(aValue) = Price_Break then sum of QuoteValue(bValue) should be greater than 0.

                   

                    public void processFormRequest(OAPageContext paramOAPageContext, OAWebBean paramOAWebBean)

                    {

                      OAApplicationModule localResponseAM=paramOAPageContext.getApplicationModule(paramOAWebBean);

                          if (paramOAPageContext.getParameter("ApplyBtn")!= null)

                          {

                            OAViewObject localBidAttributesVO=(OAViewObject)localResponseAM.findViewObject("BidAttributesVO");

                            if(localBidAttributesVO!=null)

                              localBidAttributesVO.reset();

                              while(localBidAttributesVO.hasNext())

                                {         

                            OAViewRowImpl localBidAttributesVORow = (OAViewRowImpl) localBidAttributesVO.next();

                            String aValue = (String)localBidAttributesVORow.getAttribute("AttributeName");

                            String bValue = (String)localBidAttributesVORow.getAttribute("Value");

                            String cValue = (String)localBidAttributesVORow.getAttribute("AucMandatoryFlag");

                            int i =0;

                            int iValue=Integer.parseInt(bValue);

                            paramOAPageContext.writeDiagnostics(this,"Inside ATTRIBUTE_NAME getValue-->"+aValue,1);

                            paramOAPageContext.writeDiagnostics(this,"Inside ATTRIBUTE_NAME getValue-->"+iValue,1);

                            paramOAPageContext.writeDiagnostics(this,"Inside ATTRIBUTE_NAME getValue-->"+cValue,1);

                                  if(aValue.contains("Price_Break") && iValue<=0)

                                   {

                                     i= i+ Integer.parseInt(bValue);           

                                  //throw new OAException("Attribute Name :  " +aValue+  "  should be Greater than Zero",OAException.ERROR);

                                    }

                                    }

                             while(localBidAttributesVO.hasNext())

                             {

                               OAViewRowImpl localBidAttributesVORow = (OAViewRowImpl) localBidAttributesVO.next();

                               String aValue = (String)localBidAttributesVORow.getAttribute("AttributeName");

                               String bValue = (String)localBidAttributesVORow.getAttribute("Value");

                               String cValue = (String)localBidAttributesVORow.getAttribute("AucMandatoryFlag");

                               int iValue=Integer.parseInt(bValue);

                               if(aValue.contains("Price_Break") && iValue<=0)

                               {

                                 throw new OAException("Attribute Name :  " +aValue+  "  should be Greater than Zero",OAException.ERROR);

                             }

                          }

                          }