use of "if" in XML Write task
<xmlWrite outputFile="${system.job.workspace}/output.xml" defaultTrim="right" outputFileVariable="OutputFile" version="1.0">
<header><?xml version="1.0" encoding="UTF-8" ?></header>
<element name="vendors">
<attribute name="xmlns" value="http://www.stryker.com/party" />
<forEach inputRowSetVariable="${ResultSet}">
<element name="vendor">
<element name="name" value="${ResultSet[Supplier_Name]}" />
<element name="directFlag" value="${ResultSet[Direct_Flag]}" />
<element name="activeStatus" value="${ResultSet[Active_Status_MW]}" />
</element>
</forEach>
</element>
</xmlWrite>
[8003 - xmlWrite] Invalid value '${ResultSet[Direct_Flag] == 'true'}' for attribute 'test' in element 'if'
here's the code:
<xmlWrite outputFile="${system.job.workspace}/output.xml" defaultTrim="right" outputFileVariable="OutputFile" version="1.0">
<header><?xml version="1.0" encoding="UTF-8" ?></header>
<element name="vendors">
<attribute name="xmlns" value="http://www.stryker.com/party" />
<forEach inputRowSetVariable="${ResultSet}">
<element name="vendor">
<element name="name" value="${ResultSet[Supplier_Name]}" />
<if test="${ResultSet[Direct_Flag] == 'true'}">
<element name="directFlag" value="${ResultSet[Direct_Flag]}" />
</if>
<element name="activeStatus" value="${ResultSet[Active_Status_MW]}" />
</element>
</forEach>
</element>
</xmlWrite>
Thanks!
Sean
- Support Specialist
- Posts: 592
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
The XML If Condition was originally designed for Header/Detail relationships. Like the following:
<forEach inputRowSetVariable="${details}">
<if test="${details["TDPON"]} eq ${headers["THPON"]}">
<element name="DocShpLineItem">
<attribute name="ContainerQuantity" value="${details["TDCONQTY"]}" />
<attribute name="CommodityCode" value="${details["TDCOMCDE"]}" />
<attribute name="SKUNumber" value="${details["TDITM"]}" />
<attribute name="Description" value="${details["TDDES"]}" />
</element>
</if>
</forEach>
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696