ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker SupportMapping Node: binding of this variable has gone out of scope

Post new topicReply to topic
Mapping Node: binding of this variable has gone out of scope View previous topic :: View next topic
Author Message
jb3
PostPosted: Mon Jun 04, 2018 6:08 am Post subject: Mapping Node: binding of this variable has gone out of scope Reply with quote

Apprentice

Joined: 18 Aug 2017
Posts: 25

Hi All,

I have a requirement to map the input fields to output fields only if they have data in them.

For example, the below field should be mapped to output XML
Quote:
<amen:IncreaseAmount>100000</amen:IncreaseAmount>


but when i add the below condition for the transformation,

Quote:
fn:exists($IncreaseAmount) and (fn:nilled ($IncreaseAmount) = false)


The value does not get mapped and I get the below error:

Quote:
The Mapping node has removed the binding of the variable ''IncreaseAmount''.
The binding of this variable has gone out of scope. If this variable is used within a loop, then it will be re-bound with a new value when it is required.
Check the following messages to see the progression of the mapping process.


However without this condition, the mapping works fine.

Help please...

Thanks,
Back to top
View user's profile Send private message
martinb
PostPosted: Wed Jun 06, 2018 2:45 am Post subject: Reply with quote

Disciple

Joined: 09 Nov 2006
Posts: 191
Location: UK

Hi

Firstly the message you show regarding the variable going out of scope is not and error, this is normal behavour. if you compare the user trace logs for your Mapping with and without the problematic condition you will see this message appearing in both. Also you'll see it is reported with "BIP<nnnn>I:" where "I" is "Informational".


I suspect the issue is that your XPath condition is failing, because it is equating to a literal "false" rather than the boolean false "fn:false()".

So you should have

Code:
fn:exists($IncreaseAmount) and (fn:nilled ($IncreaseAmount) = fn:false())


or more succinctly

Code:
$IncreaseAmount and fn:not(fn:nilled($IncreaseAmount))



Note that you would only need to have the "fn:nilled" check if your input element is defined in the XML schema as being nillable.

I guess you might have got the XPath expression from the IIB Knowledge Center page cm28300_?, I'll post a comment to get that corrected.
Back to top
View user's profile Send private message
jb3
PostPosted: Thu Jun 07, 2018 6:51 am Post subject: Reply with quote

Apprentice

Joined: 18 Aug 2017
Posts: 25

martinb wrote:
Hi

Firstly the message you show regarding the variable going out of scope is not and error, this is normal behavour. if you compare the user trace logs for your Mapping with and without the problematic condition you will see this message appearing in both. Also you'll see it is reported with "BIP<nnnn>I:" where "I" is "Informational".


I suspect the issue is that your XPath condition is failing, because it is equating to a literal "false" rather than the boolean false "fn:false()".

So you should have

Code:
fn:exists($IncreaseAmount) and (fn:nilled ($IncreaseAmount) = fn:false())


or more succinctly

Code:
$IncreaseAmount and fn:not(fn:nilled($IncreaseAmount))



Note that you would only need to have the "fn:nilled" check if your input element is defined in the XML schema as being nillable.

I guess you might have got the XPath expression from the IIB Knowledge Center page cm28300_?, I'll post a comment to get that corrected.


Thank you for your suggestion of
Code:
$IncreaseAmount and fn:not(fn:nilled($IncreaseAmount))

I have implemented this, and it has resulted in the xml tags to be NOT mapped that had enumeration "" defined. But the remaining ones, which are minOccurs="0" and dont have nillable set, are still being mapped to output as empty tags.

Quote:
<m:MasterRef>DC295786</m:MasterRef>
<m:LCAmountSpec>
<c:Qualifier>O</c:Qualifier>
<c:Min>10</c:Min>
<c:Max>10</c:Max>
</m:LCAmountSpec>
<m:ExpiryDate xsi:nil="true" />
<m:ApplicationDate>2015-12-12</m:ApplicationDate>
<m:ExpiryPlace />
<m:ShipmentTo />
<m:ShipmentDate>2020-12-12</m:ShipmentDate>
<m:IssuanceChgsFor>A</m:IssuanceChgsFor>
<m:ChargeAccount />
<m:IncreaseAmount>
<c:Amount>100000</c:Amount>
</m:IncreaseAmount>
<m:DecreaseAmount>
<c:Amount />
</m:DecreaseAmount>
<m:AmendChanges>no extra charges</m:AmendChanges>


I tried setting one of the above tag as nillable="true". But upon testing, that tag is still mapped as empty. (Whereas i shouldn't be mapping the xml if it is empty)

I could go back to using the esql compute node (IF exists/NULL/FIELDVALUE) for this transformation
OR
have the schema's fixed if the issue is with them, but i would really like to continue using the mapping node.

Thanks,
Back to top
View user's profile Send private message
martinb
PostPosted: Thu Jun 07, 2018 7:49 am Post subject: Reply with quote

Disciple

Joined: 09 Nov 2006
Posts: 191
Location: UK

Hi

I think the first thing you need here is a clear specification of the transformation rule you are trying to implement.

From the Xpath you were initially trying to get working it would imply the specification was:

Quote:
Set the output if the input element is present and not nilled


However your last response suggests a specification more like:

Quote:
Set the output if the input element is present and not empty


Assuming this you need to modify the condition to test for "empty". Note that testing for empty on elements that are types as xsd:string is simple, but you might need to consider what this means for numeric etc elements. Normally these would be nilled when no valid numeric value is set.

The following topic shows details of various conditions to check for empty etc:
Defining an XPath conditional expression for a transform


Another point to consider is the schema definition of the output XML you are building. If an element is defined in the schema as mandatory, "minOccurs=1" the mapping node will be adding the element to ensure that the output is conforming to the schema mode.

HTH
Back to top
View user's profile Send private message
jb3
PostPosted: Tue Jun 12, 2018 7:07 am Post subject: Reply with quote

Apprentice

Joined: 18 Aug 2017
Posts: 25

Hi Martinb,

My initial assumption was to check for nillable but then after checking with front team, I got to know that they are sending empty strings (i thought they existed only in past )

So your suggestions have been really helpful. I am now checking for (exists/null/empty strings) all in mapping node and it is working as expected.


Thanks again,
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportMapping Node: binding of this variable has gone out of scope
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.