Get data from unbound element without using looping functiod

Home Page Forums BizTalk 2004 – BizTalk 2010 Get data from unbound element without using looping functiod

Viewing 2 reply threads
  • Author
    Posts
    • #19446

      Hi!

      I have problem in the mapper. I try to get info from an unbound record.

      The data is

      ProcessInstructions
      Instruction
      PIValueParameter name=”InRef” value=”20070815001″ /
      PIValueParameter name=”OutRef” value=”200708150001″ /
      PIComplexParameter name=”ChannelProperties” value=”BANK”
      PIAttribute name=”Status” value=”TEST” /
      /PIComplexParameter
      /Instruction
      /ProcessInstructions

      (removed tags so data shows)

      What I need is to map “inRef” and “OutRef” to two different elements in the destination schema. I tried looping function, but that won’t work on this. I made it work with the index function. Set index 1 to get “InRef” and index 2 to get “OutRef”. But I don’t like this solution, since I can’t be sure that the data always will come in this order.

      Does anyone know how I could kind of loop thru the data and get the data I want, or how I could get the data using xslt?

      Thanks for help!

    • #19451

      Hello,

      This is quite easy using inline XSLT in a map, simply create two Scripting Functoids and use the following Inline XSLT:

      <InRefOutputNode>
      <xsl:value-of select=”//Instruction/PIValueParameter[@name = ‘InRef’]/@value” />
      </InRefOutputNode>

      Simply replace the bold @name = ‘InRef’ with @name = ‘OutRef’ to extract that value in your second Scripting Functoid. Further details about how to use this functiod for Inline XSLT can be found at the MSDN website: http://technet.microsoft.com/en-us/library/ms916558.aspx

      As an aside, I don’t actually like how the Bts mapper does inline XSLT – the //Instruction designation for starters isn’t valid XSLT and doesn’t start with your root element, which seems a bit strange. Anyway, the XSLT code above works!

      Hope this helps, Nick.

       

    • #19458

      The correct answer is not to use inline XSLT. This displays a basic lack of skills with the mapping tool.

      The way to properly acheive this is to use a conditional mapper with the logical detecting the desired value of InRef or OutRef as the case may be. Then link the conditional mapper to a cumulative string functoid to get it to loop through all iteration of that element. Evaluate the output of the cumulative to detect non blank and then conditionally map that to the target element.

      Depending on the data, you might also need to limit the looping level to 1 by adding the 1 as the second parameter to the cumulative string functoid.

      • #19462

        i feel the solution with scripting functoid is better.  because you can achieve the same result in one step rather than using multiple functoids.  every functoid is a different call to the XLang engine.  the fewer the functoids, the better it is.  i guess i am right, any other thoughts?

      • #19464

        The correct answer is not to use inline XSLT. This displays a basic lack of skills with the mapping tool.

        I don’t agree with this statement – using inline XSLT is perfectly acceptable in this situation. The solution you have proposed is overly complex and will be a maintenance nightmare! In fact, I personally don’t like the mapper and prefer to use entriely custom XSLT when doing anything that is non-trivial – XSLT is suscint and easily readable, not requiring an understanding of the BizTalk mapper before maintaining the code. The solution you have proposed is overkill, IMHO.

        However, at the end of the day it is upto the poster of the original question how they wish to proceed with the desired solution: they now have two possible options to help implement the solution.

        Regards, Nick.

Viewing 2 reply threads
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.