Problems with If statement inside of foreach loop.

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
6 posts Page 1 of 1

john_a

Posts: 9
Joined: Tue Nov 03, 2015 5:35 pm

Post by john_a » Thu Mar 17, 2016 6:47 pm
I am somewhat confused as to why I cannot set a simple 'IF' statement in my foreach loop which is inside my convert to Xml.

Here is the perplexing bit -
This is acceptable syntax...
${varData[3]} eq ${varData[1]}

But when I try to use the 'ne' operator it is not acceptable syntax. In point of fact nothing but that actually is acceptable but that is not what I need to compare.

Here are some things I have tried and are all failing.

[8003 - Convert to XML] Invalid value '${varData[3]} ne ${varData[1]}' for attribute 'test' in element 'if'

[8003 - Convert to XML] Invalid value '${IsNotEmpty(varData[3])}' for attribute 'test' in element 'if'

[8003 - Convert to XML] Invalid value '${IsNotNull(${varData[3]})}' for attribute 'test' in element 'if'

[8003 - Convert to XML] Invalid value '${IsNotNull(varData[3])}' for attribute 'test' in element 'if'

Can someone tell me what is wrong with my syntax? What I would really like to do is this -
<if test="IsNotNull(${varData[3]})">

Support_Rick

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

Post by Support_Rick » Thu Mar 17, 2016 7:02 pm
Change your statement from this:

${varData[3]} ne ${varData[1]}

To this:

${varData[3] ne varData[1]}

Then try it again...
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

john_a

Posts: 9
Joined: Tue Nov 03, 2015 5:35 pm

Post by john_a » Thu Mar 17, 2016 7:08 pm
Actually what I really want to do is test varData[3] for null as I previously said and no that did not work and returns this error in "RED".

[8003 - Convert to XML] Invalid value '${varData[3] ne varData[1]}' for attribute 'test' in element 'if'

Support_Rick

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

Post by Support_Rick » Tue Mar 22, 2016 1:19 pm
John,

My apologies, but I thought this was something else...

The XML Condition is literally if there are matching records in a rowset, not for conditional element display. This means that it's treated like a Header/Detail format... the condition is "if there's a matching detail to the header" not the option of something like "if this value is null".

So, to accommodate what you're looking for, it will have to happen in the SQL Select and/or by setting separate rowsets with associated values.

Hope this makes sense.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

john_a

Posts: 9
Joined: Tue Nov 03, 2015 5:35 pm

Post by john_a » Tue Mar 22, 2016 1:20 pm
I did find a solution to this and yes I see that the only conditional operators that are allowed are EQ and NE.

Support_Tim

Posts: 35
Joined: Mon Dec 01, 2014 10:35 am

Post by Support_Tim » Fri Apr 15, 2016 1:14 pm
Hi John,
I know we found your answer last month, but just wanted to follow up here for others.

When comparison expressions are embedded within loop in a Write XML task, the ‘NE’ is not supported. As you have found, you need to use the ‘EQ’ instead and alter your logic accordingly.

Support for the ‘NE’ is being considered by development for new releases, but a release date or version has not yet been determined.
6 posts Page 1 of 1