PuffTMD
PuffTMD

Reputation: 63

BizTalk Mapper Check and Replace Default Values

I have created a number of functoids on the map to validate the source node 'AdoptedDate' for default values (Equals defaultvalues into an Logical OR through to a Value functoid with a new default value. Then an Logical Not for if neither of the Equals are not true to map the source node 'AdoptedDate' across to the destination schema (xslt enclosed).

What I would like to do is implement this for all date fields in the source schema, can this be done.

Current Generated XSLT (Adopted Only)

 <xsl:for-each select="Form/SDetails">
<xsl:variable name="var:v17" select="userCSharp:LogicalEq(string(NameDetails/AdoptedDate/text()) , &quot;1900-09-09&quot;)" />
<xsl:variable name="var:v18" select="string(NameDetails/AdoptedDate/text())" />
<xsl:variable name="var:v19" select="userCSharp:LogicalEq($var:v18 , &quot;1800-09-09&quot;)" />
<xsl:variable name="var:v20" select="userCSharp:LogicalOr(string($var:v17) , string($var:v19))" />
<xsl:variable name="var:v22" select="userCSharp:LogicalNot(string($var:v20))" />
    <xsl:if test="string($var:v20)='true'">
        <xsl:variable name="var:v21" select="&quot;1901-01-01&quot;" />
        <p:AdoptedDate>
              <xsl:value-of select="$var:v21" />
        </p:AdoptedDate>
    </xsl:if>
    <xsl:if test="string($var:v22)='true'">
        <xsl:variable name="var:v23" select="NameDetails/AdoptedDate/text()" />
        <p:AdoptedDate>
            <xsl:value-of select="$var:v23" />
        </p:AdoptedDate>
    </xsl:if>

Upvotes: 0

Views: 564

Answers (1)

Dijkgraaf
Dijkgraaf

Reputation: 11527

Your options are

  1. Use the same set of functoids on each field (this is what I take it you are trying to avoid)
  2. Create an external class implements the logic that you can then call from the Scripting functoid.
  3. Create an in-line script to do the logic. You can then have subsequent scripting fuctoids containing the same function name and parameters and it will only have a single script in the XSLT that they all call.

In all situations you will have to have to have a functoid linked to the source and destination fields.

Upvotes: 1

Related Questions