Do not send tag if no data

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
2 posts Page 1 of 1

dhascup

Posts: 5
Joined: Mon Mar 24, 2014 9:11 am

Post by dhascup » Thu Oct 01, 2015 1:47 pm
Sending XML invoice to customer

if 1%60 net 61, we send the following:
<PaymentTerm payInNumberOfDays="60">
<Discount>
<DiscountPercent percent="1.000"/>
</Discount>
</PaymentTerm>
<PaymentTerm payInNumberOfDays="61"/>


if net 60, we currently send:
<PaymentTerm payInNumberOfDays="">
<Discount>
<DiscountPercent percent=""/>
</Discount>
</PaymentTerm>
<PaymentTerm payInNumberOfDays="60"/>


They are rejecting this and they want us to send:
<PaymentTerm payInNumberOfDays="60"/>


I tried using the SkipIfEmpty = true but receiving an error.

Linoma support told me : "you cannot use the Skip If Empty function with child elements and/or elements."

Thanks in advance for the help
David

Support_Rick

Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Thu Oct 01, 2015 2:26 pm
David,

What you were told by Support is correct ... if the element contains sub-elements or attributes, then the value for "skipIfEmpty" is ignored or not allowed.

In your code, you have:
Code: Select all
<element name="PaymentTerm">
	<attribute name="payInNumberOfDays" value="${dataHeader[41]}" />
	<element name="Discount">
		<element name="DiscountPercent">
			<attribute name="percent" value="${dataHeader[42]}" trim="both" />
		</element>
	</element>
</element>
"payInNumberOfDays" is an attribute of the element "PaymentTerm" that has sub-elements and attributes, which isn't allowed in that scenario by definition.

Your post also contains the following statement:
They are rejecting this and they want us to send:
<PaymentTerm payInNumberOfDays="60"/>
Which corresponds to this:
Code: Select all
<element name="PaymentTerm">
	<attribute name="payInNumberOfDays" value="${dataHeader[43]}" />
</element>
Which could utilize the option of ${system.emptyString} as the null substitute for the value so that it represents a "blank" if nothing is presented.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1