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 Index » WebSphere Message Broker (ACE) Support » fn:not and fn:boolean, map at false?

Post new topic  Reply to topic
 fn:not and fn:boolean, map at false? « View previous topic :: View next topic » 
Author Message
shashivarungupta
PostPosted: Wed Apr 29, 2015 5:41 pm    Post subject: fn:not and fn:boolean, map at false? Reply with quote

Grand Master

Joined: 24 Feb 2009
Posts: 1343
Location: Floating in space on a round rock.

Hi,

Using Graphical Mapper, I am trying to map a field (input message assembly) with output field (output message assembly) if boolean field value is false (of input message assembly ).
(i.e. Map when input boolean field value is false).

To do that I could use fn:boolean or fn:not or combination of those. But it doesn't seem to work for me (), 'If' transformation is used where condition was fn:not($in)

if $in = true then fn:not($in) should return false.
if $in = false then fn:not($in) should return true.

Is there any otherway to use it's (fn:not()) functionality? Is there any other way to map on boolean false without having elseif or else transformation?

[MBv8 FP4].

Thanks.
_________________
*Life will beat you down, you need to decide to fight back or leave it.
Back to top
View user's profile Send private message Send e-mail
martinb
PostPosted: Fri May 01, 2015 3:07 am    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

Hi,

What is probably catching you out here is that your test is using the XPath "effective boolean value" of the path that your "$in" resolves to.

Are you sure that the input element is correctly typed?
- xsd:boolean in the schema model
- Instance data is BOOLEAN in the Broker tree?

If it's a CHAR with a string value of "false" then the XPath effective boolean value is indeed true.
Back to top
View user's profile Send private message
shashivarungupta
PostPosted: Sun May 03, 2015 1:45 pm    Post subject: Reply with quote

Grand Master

Joined: 24 Feb 2009
Posts: 1343
Location: Floating in space on a round rock.

martinb wrote:

What is probably catching you out here is that your test is using the XPath "effective boolean value" of the path that your "$in" resolves to.

In graphical mapper, the mapping looks like (where IF ELSE Conditional Mapping is used):

Code:

element 'in' ---> [IF]  fn:not($in)  ---> [MOVE] element 'out4'
                 ----> [ELSE] ----> [MOVE] element 'out5'

And when I pass value true or false to element 'in' it takes the [ELSE] path to element 'out5'. ('out4' and 'out5' are boolean type elements.)

Whereas it should have happened like:
with true value to 'in' it should get mapped to 'out5'
with false value to 'in' it should get mapped to 'out4'

martinb wrote:

Are you sure that the input element is correctly typed?
- xsd:boolean in the schema model

An element is defined as mentioned below in the schema and that looks fine as its type is 'xsd:boolean' .
<xsd:element name="in" type="xsd:boolean" minOccurs="0" maxOccurs="1" />

martinb wrote:

- Instance data is BOOLEAN in the Broker tree?

Yes, when I ran the test with debug, in the Broker tree I could see the value for that element as BOOLEAN, like:
in:BOOLEAN:true
in:BOOELAN:false

Any suggestion?

_________________
*Life will beat you down, you need to decide to fight back or leave it.
Back to top
View user's profile Send private message Send e-mail
shashivarungupta
PostPosted: Sun May 03, 2015 2:10 pm    Post subject: Reply with quote

Grand Master

Joined: 24 Feb 2009
Posts: 1343
Location: Floating in space on a round rock.

martinb wrote:
.....
If it's a CHAR with a string value of "false" then the XPath effective boolean value is indeed true.


When I look at the Info Centre[v8] again, at following URL.
I see that description of 'fn:not' is given, referencing DFDL.

Since I am using XMLNSC parser, I was wondering if graphical mapper can really use this function effectively or not { ...eventually I don't find any fix in FP4 of v8, that'ld be related to fn:not(), and it seems that mapper can use it effectively... }?


_________________
*Life will beat you down, you need to decide to fight back or leave it.
Back to top
View user's profile Send private message Send e-mail
martinb
PostPosted: Sun May 03, 2015 11:45 pm    Post subject: Reply with quote

Master

Joined: 09 Nov 2006
Posts: 210
Location: UK

Quote:
When I look at the Info Centre[v8] again, at following URL.
I see that description of 'fn:not' is given, referencing DFDL.

Since I am using XMLNSC parser, I was wondering if graphical mapper can really use this function effectively or not



Yes the DFDL parser also supports use of XPath functions, for things like choice discriminators, etc.

The definition given on the DFDL spec expressions page agrees with the point I'm making

Quote:
fn:not Inverts the xs:boolean value of the argument.


Note that it explicitly states that the argument must be of value type "xs:boolean".

So when you are using fn:not with XMLNSC this means that the schema type of the element must be "xs:boolean", and you must have the XMLNSC parser option "Build tree using XML Schema data types" set on.


Alternatively if your data element value being used in the mapper is not a "xs:boolean" type you can use an explicit type cast, for example

Code:
fn:not( xs:boolean($in) )
Back to top
View user's profile Send private message
shashivarungupta
PostPosted: Tue May 05, 2015 5:55 pm    Post subject: Reply with quote

Grand Master

Joined: 24 Feb 2009
Posts: 1343
Location: Floating in space on a round rock.

Quote:
fn:not( xs:boolean($in) )


Thanks martinb, this works.


_________________
*Life will beat you down, you need to decide to fight back or leave it.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » fn:not and fn:boolean, map at false?
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.