2 Replies Latest reply on Oct 18, 2010 3:21 PM by 805279

    Optional Parameter in ODSI

    805279
      Hi,

      I have to create a Optional Parameter in ODSI function as given following :

      xquery version "1.0" encoding "UTF-8";

      (::pragma xds <x:xds targetType="urn:AddressInfo" xmlns:x="urn:annotations.ld.bea.com" xmlns:urn="http://www.wcbsask.com/employeerCoverage/AddressInfo"><creationDate>2010-10-15T15:19:40</creationDate><userDefinedView/></x:xds> ::)

      declare namespace wbt= "ld:Physical/CBC";

      import schema namespace ns1="http://www.abc.com/employeerCoverage/AddressInfo" at "ld:Logical/AddressInfo/schemas/AddressInfo.xsd";


      declare namespace tns="ld:Logical/AddressInfo/SampleOptional";

      (::pragma function <f:function kind="read" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.bea.com"/>::)

      declare function tns:getSampleOptional($formNum as xs:string,$optinalInput as xs:integer?) as element(ns1:AddressInfo)?{
      for $cbc in wbt:CBC()
      where $formNum eq $cbc/FORM_NUM
      return
      <ns1:AddressInfo>
      {
      if(exists($optinalInput))then
      <ns1:regNum>{fn:data($CBC/FORM_NUM)}</ns1:regNum>
      else(
      <ns1:cusNumber>{fn:data($optinalInput)}</ns1:cusNumber>
      )
      }
      </ns1:AddressInfo>


      };

      when i am passing the form number as some value and OptionalInput as null(since the parameter is optional). I am getting error as
      com.bea.dsp.das.exception.DASException: weblogic.xml.query.exceptions.XQueryDynamicException: {err}XP0021: "": can not cast to {http://www.w3.org/2001/XMLSchema}integer: error: decimal: Invalid decimal value: expected at least one digit
           at com.bea.dsp.das.ejb.EJBClient.invokeOperation(EJBClient.java:160)
           at com.bea.dsp.das.DataAccessServiceImpl.invokeOperation(DataAccessServiceImpl.java:171)
           at com.bea.dsp.das.DataAccessServiceImpl.invoke(DataAccessServiceImpl.java:122)
           at com.bea.dsp.ide.xquery.views.test.QueryExecutor.invokeFunctionOrProcedure(QueryExecutor.java:113)
           at com.bea.dsp.ide.xquery.views.test.XQueryTestViewContent.getFunctionExecutionResult(XQueryTestView.java:1041)
           at com.bea.dsp.ide.xquery.views.test.XQueryTestViewContent.executeFunction(XQueryTestView.java:1176)
           at com.bea.dsp.ide.xquery.views.test.XQueryTestViewContent.widgetSelectedImpl(XQueryTestView.java:1866)
           at com.bea.dsp.ide.xquery.views.test.XQueryTestViewContent.access$300(XQueryTestView.java:174)
           at com.bea.dsp.ide.xquery.views.test.XQueryTestViewContent$3.run(XQueryTestView.java:1594)
           at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
           at com.bea.dsp.ide.xquery.views.test.XQueryTestViewContent.widgetSelectedBusy(XQueryTestView.java:1597)
           at com.bea.dsp.ide.xquery.views.test.XQueryTestViewContent.widgetSelected(XQueryTestView.java:1560)
           at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
           at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
           at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
           at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3687)
           at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3298)
           at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
           at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
           at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
           at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
           at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
           at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
           at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
           at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
           at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
           at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
           at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
           at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
           at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
           at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
           at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
           at org.eclipse.equinox.launcher.Main.eclipse_main(Main.java:1148)
           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.m7.installer.util.NitroxMain$1.run(NitroxMain.java:33)
           at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
           at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
           at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
           at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
           at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
           at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
           at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
           at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

      Kindly help in the issue.

      Regards,
      Tara