Loop through multiple records


hi, have mapping problem tried biztalk mapper unable loop through desired output.

if mode or g or e,then map outbound schema claim elements level after header generation. for each inbound message there multiple claimdetails , in each claimdetails there can max of 3 claims. in each of claims(max 3) if found true first records elements goes claim1 , subsequently till claim2 , claim3 record elements.

input: 

<ns0:response xmlns:ns0='http://schemas.response'>
  <ns1:objectresponse xmlns:ns0="http://schemas.objects" xmlns:ns1="http://schemas.claimresponse" recordexist="n" format="ff" id="n" destination="cdd">

<ns1:claimsresponse>
<ns1:batchno>12</ns1:batchno>
<ns1:claimdetails>
<ns1:claims>
<ns1:no>1</ns1:no>
<ns1:member>1</ns1:member>
<ns1:services>
<ns1:mode>e</ns1:mode>
<ns1:state>ma</ns1:state>
<ns1:procedure>d291</ns1:procedure>
</ns1:services>
</ns1:claims>
<ns1:claims>
<ns1:no>2</ns1:no>
<ns1:member>1</ns1:member>
<ns1:services>
<ns1:mode>a</ns1:mode>
<ns1:state>ma</ns1:state>
<ns1:procedure>d291</ns1:procedure>
</ns1:services>
</ns1:claims>
</ns1:claimdetails>

<ns1:claimdetails>
<ns1:no>2</ns1:no>
<ns1:member>6</ns1:member>
<ns1:services>
<ns1:mode>a</ns1:mode>
<ns1:state>ny</ns1:state>
<ns1:procedure>d291</ns1:procedure>
</ns1:services>
</ns1:claimdetails>

<ns1:claimdetails>
<ns1:no>4</ns1:no>
<ns1:member>3</ns1:member>
<ns1:services>
<ns1:mode>g</ns1:mode>
<ns1:state>nh</ns1:state>
<ns1:procedure>d291</ns1:procedure>
</ns1:services>
</ns1:claimdetails>
</ns1:claimsresponse>
</ns1:objectresponse>
</ns0:response>

 output:

<ns0:outbound xmlns:ns0="http://schemas.outbound">
<ns0:header>
<ns0:format>ff</ns0:format>
<ns0:count>3</ns0:count>
<ns0:date>20121007</ns0:date>
<ns0:exists>20121007</ns0:exists>
</ns0:header>
<ns0:claimdetails>
<ns0:claim1>
<ns0:no1>1</ns0:no1>
<ns0:mode1>e</ns0:mode1>
<ns0:state1>ma</ns0:state1>
<ns0:procedure1>d291</ns0:procedure1>
</ns0:claim1>
<ns0:claim2>
<ns0:no1>2</ns0:no1>
<ns0:mode2>a</ns0:mode2>
<ns0:state2>ma</ns0:state2>
<ns0:procedure2>d291</ns0:procedure2>
</ns0:claim2>
</ns0:claimdetails> 
<ns0:claimdetails>
<ns0:claim1>
<ns0:no1>2</ns0:no1>
<ns0:mode1>a</ns0:mode1>
<ns0:state1>ny</ns0:state1>
<ns0:procedure1>d291</ns0:procedure1>
</ns0:claim1>
</ns0:claimdetails>
<ns0:claimdetails>
<ns0:claim1>
<ns0:no1>4</ns0:no1>
<ns0:mode1>g</ns0:mode1>
<ns0:state1>nh</ns0:state1>
<ns0:procedure1>d291</ns0:procedure1>
</ns0:claim1>
</ns0:claimdetails>
</ns0:outbound>

thanks

 

hi,

you can solve problem combining functoids custom xslt. final result should like:


inside scripting functoid (custom xslt), write following code:

<xsl:for-each select="s0:claimsresponse/s0:claimdetails">
<claimdetails>
<claim>
<no1>
<xsl:value-of select="s0:no/text()" /> 
</no1>
<xsl:for-each select="s0:services">
<mode1>
<xsl:value-of select='s0:mode/text()'/>
</mode1>
<state1>
<xsl:value-of select='s0:state/text()'/>
</state1>
<procedure1>
<xsl:value-of select='s0:procedure/text()'/>
</procedure1>
</xsl:for-each>
</claim>
<xsl:for-each select="s0:claims">
<claim>
<no1>
<xsl:value-of select='s0:no/text()'/>
</no1>
<xsl:for-each select="s0:services">
<mode1>
<xsl:value-of select='s0:mode/text()'/>
</mode1>
<state1>
<xsl:value-of select='s0:state/text()'/>
</state1>
<procedure1>
<xsl:value-of select='s0:procedure/text()'/>
</procedure1>
</xsl:for-each>
</claim>
</xsl:for-each>
</claimdetails>
</xsl:for-each>

if want project example, download here: https://www.dropbox.com/s/orc5gwr64gzs5iy/mapchallenge_08-10_2012.zip

hope you,

rui machado


rui machado



BizTalk Server  >  BizTalk Server General



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'