1 2 Previous Next 23 Replies Latest reply on Dec 14, 2017 4:51 PM by Tom Hora-Oracle

    How to use position() in map

    2632939

      Hi,

       

      I have a requirement to use position() of an element in for-each of a map in ICS.

      I mean

       

      Eg: In Map I want to use something like this

                  <xsl:for-each select="$readTimeEntryFile/nsmpr0:SyncReadFileResponse/nsmpr2:FileReadResponse/nsmpr3:timeEvents/nsmpr3:timeEvent[position()&gt;=$from and position()&lt;$from+500]">

       

      However I dont see how to do it in ICS mapper UI.

       

      While I can do the same in Jdeveloper ( importing the xsl ) , I have a need to use a variable ( $from) which is defined in the process flow in ICS.

      So when I import the XSLT to ICS ( after making required changes to for-each condition as above in Jdeveloper) and run the integration , I get below error

       

      oracle.xml.xpath.XPathException: Variable not defined: 'from'.

      at oracle.xml.xpath.XPathVarReference.evaluate(XPathVarReference.java:208)

      at oracle.xml.xpath.ComparisonExpr.evaluate(XSLExpr.java:1745)

       

      So in summary , I am looking for either

      1) Ability to use position() inside mapper in ICS

      or

      2) Ability to use simple variables defined in ICS flow , inside the imported XSLT of the mapper.

        • 1. Re: How to use position() in map
          Hemanth Lakkaraju-Oracle

          You need to create a variable 'from' in orchestration and add value to it using assign. Then in the mapper you can see the variable as well apart from the input and output.

           

          Then you need to map the actual element (in your example timeEvent) and then edit the mapped field to add the predicate to include the 'from' variable.

           

          Refer  Re: How can I type XPath expressions with predicates in the ICS Mapper?  this thread for steps for adding predicates.

          • 2. Re: How to use position() in map
            2632939

            Hemanth,

             

             

            You need to create a variable 'from' in orchestration and add value to it using assign. Then in the mapper you can see the variable as well apart from the input and output.

            Did this.

             

            Then you need to map the actual element (in your example timeEvent) and then edit the mapped field to add the predicate to include the 'from' variable.

             

            I am not able to edit this condition inside for-each select

             

             

            As stated before I want to edit to this

             

            <xsl:for-each select="$readTimeEntryFile/nsmpr0:SyncReadFileResponse/nsmpr2:FileReadResponse/nsmpr3:timeEvents/nsmpr3:timeEvent[position()&gt;=$from and position()&lt;$from+500]">

            • 3. Re: How to use position() in map
              Hemanth Lakkaraju-Oracle

              Right click and say input literal. Then copy the xpath from the above line and add the predicate as required.

              1 person found this helpful
              • 4. Re: How to use position() in map
                2632939

                Hemanth,

                 

                I have created 'from' variable and tried to add it as predicate in my for-each select xpath as below

                <xsl:for-each select="$readTimeEntryFile/nsmpr0:SyncReadFileResponse/nsmpr2:FileReadResponse/nsmpr3:timeEvents/nsmpr3:timeEvent[position() >= $from and position() < $from+500]">

                 

                Still I get below error:

                oracle.xml.xpath.XPathException: Variable not defined: 'from'.

                at oracle.xml.xpath.XPathVarReference.evaluate(XPathVarReference.java:208)

                 

                Not sure why $from is not recognizable. If I replace it with any number manually it works..

                • 5. Re: How to use position() in map
                  Jorge Herreria-Oracle

                  If  $from is not shown in the Sources panel in the Mapper UI, that is an indication that the "from" variable has not been assigned (Assign activity) before the Map activity in the orchestration.

                  • 6. Re: How to use position() in map
                    2632939

                    Jorge Herreria-Oracle wrote:

                     

                    If $from is not shown in the Sources panel in the Mapper UI, that is an indication that the "from" variable has not been assigned (Assign activity) before the Map activity in the orchestration.

                    $from is shown in the Sources panel in Mapper UI. But when I use it inside the predicate, I get an error at runtime.

                    • 7. Re: How to use position() in map
                      Tom Hora-Oracle

                      2632939 Are you saying the mapper UI is allowing it, and it fails only at runtime?

                       

                      Jorge Herreria-Oracle If the error is happening at runtime, could this be due to the fact that scalar variables in ICS are untyped (only strings) at this time?

                      • 8. Re: How to use position() in map
                        Tom Hora-Oracle

                        2632939 Can you try casting the variable to numeric like this:

                         

                        number($from)

                        • 9. Re: How to use position() in map
                          2632939

                          number($from) too didn't work

                           

                          My Mapper UI

                           

                           

                          Mapper UI on click of the mapping

                           

                           

                          Error:

                          [2017-12-07T04:08:16.769+00:00] [ics_server2] [ERROR] [] [oracle.soa.bpel.engine] [tid: [ACTIVE].ExecuteThread: '13' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: satya.yenamandra@nttdata.com] [ecid: 005NvWqfpWSA9T3_RlP5id0002yy0000J9,1:25368] [APP: soa-infra] [oracle.soa.tracking.FlowId: 1200583] [oracle.soa.tracking.InstanceId: 15895] [oracle.soa.tracking.SCAEntityId: 10726] [composite_name: ScheduledOrchFlow!1.0] [FlowId: 0000M0jAAg_6yGhpp8l3iY1Q54eu00003Y] , Cikey=15895, FlowId=1200583, Current Activity Key=15895-BpAss112-BpSeq19.27-7, Current Activity Label=transformer1, InvokeMessageGuid=3e3c49f4-db04-11e7-85a7-c6b03b13e19f, ComponentDN=default/OTLINTEGRATION!01.00.0000*soa_19c30f07-3a86-420e-83d5-9a79567ed4b0/OTLINTEGRATION[[

                          oracle.xml.xpath.XPathException: Variable not defined: 'from'.

                          at oracle.xml.xpath.XPathVarReference.evaluate(XPathVarReference.java:208)

                          at oracle.xml.xpath.XPathConvertAsExpr.evaluate(XPathFunctionCall.java:1818)

                          at oracle.xml.xpath.XPathFunctionCall.evaluate(XPathFunctionCall.java:781)

                          at oracle.xml.xpath.ComparisonExpr.evaluate(XSLExpr.java:1745)

                          at oracle.xml.xpath.XSLExprBase.testBooleanExpr(XSLExprBase.java:499)

                          at oracle.xml.xpath.AndExpr.evaluate(XSLExpr.java:524)

                          at oracle.xml.xpath.XPathPredicate.filter(XPathPredicate.java:331)

                          at oracle.xml.xpath.XPathChildAxis.getNodeList(XPathAxis.java:627)

                          at oracle.xml.xpath.XPathStep.evaluate(XPathStep.java:1080)

                          at oracle.xml.xpath.PathExpr.evaluate(PathExpr.java:780)

                          at oracle.xml.xslt.XSLForEach.processAction(XSLForEach.java:153)

                          at oracle.xml.xslt.XSLNode.processChildren(XSLNode.java:518)

                          at oracle.xml.xslt.XSLTemplate.processAction(XSLTemplate.java:252)

                          at oracle.xml.xslt.XSLStylesheet.execute(XSLStylesheet.java:683)

                          at oracle.xml.xslt.XSLProcessor.processXSL(XSLProcessor.java:360)

                          at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:539)

                          at com.collaxa.cube.xml.xpath.functions.xml.DoXSLTransform.transform(DoXSLTransform.java:463)

                          at com.collaxa.cube.xml.xpath.functions.xml.DoXSLTransform.call(DoXSLTransform.java:163)

                          at com.collaxa.cube.xml.xpath.BPELXPathFunctionWrapper.evaluate(BPELXPathFunctionWrapper.java:78)

                          at oracle.xml.xpath.JXPathContext$JXFunction.invoke(JXPathContext.java:213)

                          at oracle.xml.xpath.JXPathContext$JXFunction.invoke(JXPathContext.java:182)

                          at oracle.xml.xpath.XPathExtFunction.evaluate(XPathExtFunction.java:335)

                          • 10. Re: How to use position() in map
                            Tom Hora-Oracle

                            One other thought came to mind.  We optimize the code by removing "unused" variables.  This sounds like something that could occur if the $from stylesheet parameter was deleted from the .xsl.

                             

                            Can you try to map the $from to an innocuous field in the target (in addition to it's usage in the predicate) and let me know?

                             

                            If that doesn't work, please attach your .iar file here and we can investigate further.

                            • 11. Re: How to use position() in map
                              Jorge Herreria-Oracle

                              Following Tom's idea

                              On a target element that you do not need a map do an <xsl:if> using the $from.

                              Example: Lets say timeEventRequestId does not need to be mapped. Then here's the mapping:

                              <xsl:if test="$from = '1' and $from='2'>

                                  <nsmpr:timeEventRequestId.>

                              </xsl:if>

                               

                              Notice the "if" will be never true, so it will not create a timeEventRequestId element.

                              • 12. Re: How to use position() in map
                                Sankar-JV-Oracle

                                Tom Hora-Oracle good catch. That's the issue, I guess. From the screenshot, its evident that Mapper is not marking "$from" as "Mapped" (no green tick mark). So that is probably the issue.

                                • 13. Re: How to use position() in map
                                  Hemanth Lakkaraju-Oracle

                                  I agree with Tom/Sankar below. APart from Jorge's suggestion, you can try do the following as well to get $from into the xsl as a param.

                                   

                                  After for-each loop before adding predicate, try mapping $from to any element inside the for-each section.

                                  Then edit the for-each section as required. Remove the above $from mapping to the element as do normal mapping as required.

                                  • 14. Re: How to use position() in map
                                    Sankar-JV-Oracle

                                    hi, can you confirm if the work around resolved the issue for you ?

                                    1 2 Previous Next