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 » Using fn:substring

Post new topic  Reply to topic
 Using fn:substring « View previous topic :: View next topic » 
Author Message
petervh
PostPosted: Tue Sep 04, 2007 1:23 am    Post subject: Using fn:substring Reply with quote

Apprentice

Joined: 15 Jun 2006
Posts: 31

I'm trying to use the fn:substring function in a mapping node expression to truncate the first character from the source field before it gets mapped to the target field.

I coded:

fn:substring($Source/xxx/xxx from 2 for 3)

in the editor but I get an error "Invalid expression syntax: expression sequence". I'm sure this is pretty easy, but I can't seem to get it to work. Can someone help? Thanks.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Sep 04, 2007 1:34 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

fn:substring does not exist, as far as I know.

You need to use xs:substring, which uses positional parameters, not named parameters...

so xs:substring($Source/xxx/xxx,2,3)
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
petervh
PostPosted: Tue Sep 04, 2007 2:00 am    Post subject: Reply with quote

Apprentice

Joined: 15 Jun 2006
Posts: 31

According to my info centre and the "ctrl space" help, the fn:substring does exist (Toolkit V6.0.2). Anybody tried this function?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Sep 04, 2007 2:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I don't mean to seem to be arguing, but I've not found such a link myself in the online Info Center....

Can you cite?

I know for a fact that xs:substring works.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
petervh
PostPosted: Tue Sep 04, 2007 4:26 am    Post subject: Reply with quote

Apprentice

Joined: 15 Jun 2006
Posts: 31

My mistake! The reference wasn't from the Info Centre, it was from:

http://www.ibm.com/developerworks/websphere/library/techarticles/0608_piper/0608_piper.html

There's also an fn:substring option if you build a line of code using the ctrl+space technique in the map editor.

Appreciate your input!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Sep 04, 2007 6:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I've never gotten fn:substring to work.

I can't speculate on whether or not the Toolkit is wrong (and Andy Piper's mention), or whether it's my own failure and the lack of documentation on the function.

But, again... I know that xs:substring does work, and does follow the documentation on the XPath functions linked from the Info Center: http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ar00870_.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
andypiper
PostPosted: Tue Sep 04, 2007 11:27 pm    Post subject: Reply with quote

Acolyte

Joined: 29 Oct 2001
Posts: 59
Location: London

Oops. This is my bad (in the article). Jeff is quite right, you need to use xs:substring to invoke the XPath substring function, and that takes numeric parameters. It's documented in the XPath language spec:

http://www.w3.org/TR/xpath#function-substring

Sorry for the confusion.
Back to top
View user's profile Send private message Visit poster's website
petervh
PostPosted: Wed Sep 05, 2007 5:49 am    Post subject: Reply with quote

Apprentice

Joined: 15 Jun 2006
Posts: 31

OK. I managed to get this working. Seems that the Toolkit is a little "variable" in this regard... Could have been a memory/project rebuild issue perhaps.

I used: fn:substring($source/xx/xx, 2, 3) and it worked to truncate the source to position 2 for 3 bytes! Thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Using fn:substring
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.