none
NEED Help - - - - - - REF Segment RRS feed

  • Question

  • Hi Guru's

    just finished my 837D Non Medicare migration map,i have a condition on my ref segment if my REF01 is 1D then am mapping REF02 value,if you see my input file down here,i have two Ref Segment one is with EI and another one is with 1D,the max occurrence "5" ,am not sure how i can loop only this record until all 5 occurance.

    When i pass this file,the map is read always the first Ref occurrence,its not reading the second occurrence ,so am not sure how can loop this segment to read all the occurrences.



    <ns0:REF_TS837Q2_2010AA_SubLoop>
    - <ns0:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA_Loop>
    - <ns0:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA>
      <REF01__ReferenceIdentificationQualifier>EI </REF01__ReferenceIdentificationQualifier>
      <REF02__BillingProviderAdditionalIdentifier>522038038</REF02__BillingProviderAdditionalIdentifier>
      </ns0:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA>
    - <ns0:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA>
      <REF01__ReferenceIdentificationQualifier>1D </REF01__ReferenceIdentificationQualifier>
      <REF02__BillingProviderAdditionalIdentifier>000854085 </REF02__BillingProviderAdditionalIdentifier>
      </ns0:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA>
      </ns0:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA_Loop>
      </ns0:REF_TS837Q2_2010AA_SubLoop>

    Thanks in Advance
    Jackie
    Monday, October 5, 2009 1:35 PM

Answers

  • Jackie,

    Email me your data file and I'll see if there is a problem that might cause looping to behave funky, and send you back a small map.  I could probably use your excerpt above but there might be something in the rest of the data hierarchy that is affecting this piece.  Although we tend to see each piece of the map as an individual operation, the fact is that a link somewhere else in the map could be affecting this.

    When you only can pick up the first item from a loop you can almost always be sure that the source data is not being looped.

    You hit the nail on the head in answering Tim.  There is nothing wrong with creating your maps in XSLT as long as you are aware of the problems that can bring down the road -- and the most frequent problem is that the next mapper who sees the map does not know XSLT. 

    Also, if you haven't already, get your company to buy you a copy of Pro Mapping in BizTalk Server 2009 -- we put lots of tips and techniques in there that may help.  Our general rule of thumb is that if you can't map a data item in less than a six functoid chain, you need to use C# or XSLT for that piece of the map.

    Thanks,


    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Tuesday, October 6, 2009 1:50 PM

All replies

  • Jackie,

    Have you tried the Value Mapping (Flattening) functoid.  Whereas the Value Mapping functoid only pulls one instance of the source the Value Mapping (Flattening) functoid pulls all instances of a simple loop.

    REF01----------->Equal Functoid---------->Value Mapping (Flattening) -------------> target
    REF02-----------------------------------------------^

    Make sure your inputs into the Value Mapping (Flattening) functoid are in the correct order, of course.


    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Monday, October 5, 2009 8:27 PM
  • Hi Jackie,

    In my experience, doing EDI mappings in the visual mapper can be quite a challenging task. You will have to build some difficult structures for it, and it will be very hard to maintain.
    I would definitely go for custom XSLT. It will give you more control over your output.

    Kind Regards
    Tim 
    Tuesday, October 6, 2009 8:02 AM
  • Jim,

    the problem am facing here is not looping all the ref segment,in the above input file,it will read only the EI not the 1D ref segment.so am trying to control the loop like.

    Ref Parent (Source)----->Looping Functoid----->13 record parent (source)
    Ref01------->Equalfuntoid (Value=1D)-------->13 record parent (source)
    Ref01---------->Equalfuntoid (Value=1D)------------>valuemapping (input one)
    Ref02----------------------------------------------------->valuemapping (input two)


    in this case i can generate an ouput for Ref 1D segment but i want to get EI value,then its not mapping.so am lacking here on some looping concept i belive.

    Thanks for your help
    Tuesday, October 6, 2009 1:33 PM
  • Hi Tim,

    True, custom XSLT gives more control but am not very familiar with Custom XSLT that's the reason am hesitate to go for it.

    Thanks
    Jackie
    Tuesday, October 6, 2009 1:34 PM
  • Jackie,

    Email me your data file and I'll see if there is a problem that might cause looping to behave funky, and send you back a small map.  I could probably use your excerpt above but there might be something in the rest of the data hierarchy that is affecting this piece.  Although we tend to see each piece of the map as an individual operation, the fact is that a link somewhere else in the map could be affecting this.

    When you only can pick up the first item from a loop you can almost always be sure that the source data is not being looped.

    You hit the nail on the head in answering Tim.  There is nothing wrong with creating your maps in XSLT as long as you are aware of the problems that can bring down the road -- and the most frequent problem is that the next mapper who sees the map does not know XSLT. 

    Also, if you haven't already, get your company to buy you a copy of Pro Mapping in BizTalk Server 2009 -- we put lots of tips and techniques in there that may help.  Our general rule of thumb is that if you can't map a data item in less than a six functoid chain, you need to use C# or XSLT for that piece of the map.

    Thanks,


    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Tuesday, October 6, 2009 1:50 PM
  • Hi Jackie,

    Learning XSLT will save you time! Really. I think I only used the mapper 2 times. During my BizTalk training.
    And from the start I felt that it couldn't always do what I want it to do. Especially for EDI maps.
    EDI sometimes has such a special structure that is totally different from your input message. Than you need to fiddle with 10 functoids to get 1 output field. And in my opinion that is just a waste. Because it's usually just a few lines in XSLT.

    If you keep struggling with this in the visual mapper, just move everything to XSLT.
    The time you spend on it in the visual mapper is the time you need to learn the XSLT basics. And at the end it will give you a lot of benefits. Specially for maintenance.

    Kind Regards
    Tim
    Tuesday, October 6, 2009 1:52 PM
  • thanks a lot Jim,

    Already i bought the Pro mapping Book,the looping concept i stole it from there only ;)(basic and advanced looping concepts ),can i get your email id, i will send my solution and data file.

    Thanks
    Jackie
    Tuesday, October 6, 2009 1:54 PM
  • Oops, sorry.  EMAIL REMOVED

    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Tuesday, October 6, 2009 1:56 PM
  • Ok, that's a new one.  jim at sspsi.com
    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Tuesday, October 6, 2009 1:57 PM
  • Hi Jim,

    It seems that you are very found of the BizTalk Mapper. And I understand your point.
    But I just see it different. XSLT is a very simples language. I learned it in less than a week.
    And if you know and use it, it will save time in both development and runtime.

    You can always use inline xslt in the scripting functoid. But why don't you write the whole thing in XSLT then?
    If you're going to learn it anyway.
    Learning XSLT is really an added value for BizTalk developers. Because if you want it or not, you will need it sometime.

    You say that it will be easier for the next mapper to have it in the Biztalk Mapper. But when I need to work on maps that were created that way, I always get lost in the whole bunch of lines and functoids. And after searching a bit, I just rewrite the whole thing in XSLT.

    But again, I understand your point in wanting to use the tools that are available.

    Kind Regards
    Tim
    Tuesday, October 6, 2009 2:14 PM
  • Sent the sln and data file to your email id,thanks a lot for your help Jim
    Tuesday, October 6, 2009 2:22 PM
  • Tim,

    Can you suggest some books for inline XSLT code for BIZTALK 2009 ?
    Tuesday, October 6, 2009 3:05 PM
  • Jackie, I just sent you a note.  In the case of this map, I agree to a degree with Tim.  The logic is very convoluted and not suitable for a functoid-based map.  The map can be simplified by gathering some of the data into variables and arrays/hash tables and then outputting it later.  However, you must know one of the scripting languages to do this.  I'm not even sure this map is a good candidate for pure XSLT except in the case of someone who is an XSLT expert.

    If you want to learn XSLT, try Apress' Beginning XSLT 2.0 by Tennison.  It addresses both 1.0 and 2.0.  Also VERY helpfule is XPATH, Navigating XML with XPATH 1.0 and 2.0 (Sams publication by Holzner.)

    As to Tim's comment earlier about us being fond of the BizTalk mapper, I don't know that I would go so far as to say "fond".   The problem I have with the view that maps should be done entirely in XSLT because they can't be done easily in the mapper is that the statement about the difficulty of mapping EDI is just not correct.  The problem is that people forget that you can use C#, XSLT, etc., in the mapper.  Like any other tool, taking the time to learn how to use it and to understand how it works is an investment that pays off.  EDI maps are easy to do in the mapper, if you use all the capabilities that are available.  It's been a long time since I've seen an 856, for instance, that I couldn't map in 2-4 hours. 

    In our case, as consultants rather than as employees of a specific company, we must be able to create maps using multiple techniques.  Some clients want their maps done entirely in XSLT; at the other extreme some clients want their maps done with the bare minimum of scripting, often not wanting XSLT used at all.

    Hope this helps,





    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Tuesday, October 6, 2009 3:37 PM
  • Hi Jackie,

    I did not use a book to learn XSLT. My source was http://www.w3schools.com/xsl/ and http://www.w3schools.com/XPath/default.asp. Maybe it's best to start with the xpath lessons. Because you will need the for XSLT.

    Jim,

    That is actually not the good book to learn XSLT for BizTalk. BizTalk does not support XSLT 2.0. Or at least not yet.
    So I would not recommend this book for this.
    And as for our little discussion regarding BizTalk mapper vs XSLT. It's a never ending story. They both have good things and bad things. I'm an XSLT enthusiast, because it feels natural to me. When I started on BizTalk, I really wanted to learn the mapper. And there are situations where I use it. But only for extremely simple mappings. And I don't even use the functoids then. :s I just prefer XSLT. I can understand that, if you really know all the functoids very well, that you can create mappings fast with that tool. I'm a consultant too, and I know that some customers like the mapper. But for us this is a very small section. 95% of our customers actually prefers XSLT because the runtime performance is slightly better. Specially for large mappings. And maybe this is a good link. http://www.sabratech.co.uk/blogs/yossidahan/2005/08/mapper-vs-xslt.html

    Kind Regards
    Tim
    Wednesday, October 7, 2009 6:02 AM
  • Thanks Tim and Jim
    Wednesday, October 7, 2009 1:39 PM
  • Jackie,

    The book that we recommend covers both 1.0 and 2.0, and we have found it to be an excellent reference for learning to use XSLT.  The www.w3schools.com/xsl are also good references for learning -- as are their schools for other languages.

    Our experience with customers is the opposite from Tim's experience -- 99% prefer minimum use of XSLT.  However, please not that I am not making a negative statement about XSLT, merely noting a fact.  Tim is missing the point of my position, which is that XSLT is a perfectly good choice for some customers and not a good choice for others.  There is no evidence to support that hand-generated XSLT maps perform better than maps generated by the mapping engine -- performance can be worse if the hand-generated XSLT is of poor quality.

    Delivering maps to a client who has no staff expertise in XSLT and then moving on to the next contract is not what we do.  Someone has to maintain the maps, and if the client has no expertise then he is being left in the lurch.  Deciding on how to create maps requires consideration of many factors, not just that one likes XSLT more or likes the mapping engine more.

    Since this discussion has evolved into a religious debate, I'll stop posting to this thread and continue working with you privately.  I have your latest email, but am on-site and have limited time.  I'll try to find a couple of hours for you.

    Take care,

    Jim

    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Wednesday, October 7, 2009 1:42 PM
  • Thanks for your time Jim,yep even i tried with inline xslt code,but still i can't able to solve my problem.

    <xsl:template name="MyXsltCallTemplate">
     <xsl:param name="param1" />
     <xsl:element name="W4880494-PAYTO-MEDICAID-PROV-ID">
      <xsl:for-each select="../../../../s1:TS837Q2_2010A_SubLoop/s1:TS837Q2_2010AA_Loop/s1:REF_TS837Q2_2010AA_SubLoop/s1:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA_Loop/s1:REF_BillingProviderSecondaryIdentificationNumber_TS837Q2_2010AA">
          <xsl:value-of select="REF02__BillingProviderAdditionalIdentifier"/>
        </xsl:for-each>
    </xsl:element>
    </xsl:template>
    Wednesday, October 7, 2009 6:32 PM
  • Hi Jackie,

    What is your issue with this xslt?

    Kind Regards
    Tim
    Thursday, October 8, 2009 6:25 AM