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 » CARDINALITY and XMLNSC

Post new topic  Reply to topic
 CARDINALITY and XMLNSC « View previous topic :: View next topic » 
Author Message
solomita
PostPosted: Fri Nov 14, 2008 1:02 pm    Post subject: CARDINALITY and XMLNSC Reply with quote

Voyager

Joined: 06 May 2003
Posts: 94

I am trying to count the number of occurences of msgCorrelated occur within this stream of data. Here is a snippet but there are definitely more than 2. I have tried this without success (ie value of 0)

DECLARE J Integer;
SET J = CARDINALITY(InputRoot.XMLNSC.asdiOutputCorrelated.msgCorrelated[]);

If i do it only up to the XMLNSC I get a value of 1 but can't seem to get farther than that.

<?xml version="1.0" ?>
- <asdiOutputCorrelated xmlns="http://tfm.faa.gov/tfms/TFMS_XIS" xmlns:nxce="http://tfm.faa.gov/tfms/contact admin" xmlns:mmd="http://tfm.faa.gov/tfms/MessageMetaData" xmlns:nxcm="http://tfm.faa.gov/tfms/contact admin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tfm.faa.gov/tfms/TFMS_XIS http://www.fly.faa.gov/ASDI/asdidocs/TFMS_XIS.xsd" timestamp="2008-10-27T18:38:55.0Z">
- <msgCorrelated flightIndex="369970">
- <asdiMessage sourceFacility="KZMP" sourceTimeStamp="2008-10-27T18:38:45.0Z">
- <trackInformation>
<nxcm:aircraftId>FFT531</nxcm:aircraftId>
- <nxcm:computerId>
<nxce:idNumber>821</nxce:idNumber>
</nxcm:computerId>
<nxcm:speed>440</nxcm:speed>
- <nxcm:reportedAltitude>
- <nxce:assignedAltitude>
<nxce:simpleAltitude>390C</nxce:simpleAltitude>
</nxce:assignedAltitude>
</nxcm:reportedAltitude>
- <nxcm:position>
- <nxce:latitude>
<nxce:latitudeDMS degrees="40" minutes="18" seconds="01" direction="NORTH" />
</nxce:latitude>
- <nxce:longitude>
<nxce:longitudeDMS degrees="099" minutes="17" seconds="00" direction="WEST" />
</nxce:longitude>
</nxcm:position>
</trackInformation>
</asdiMessage>
</msgCorrelated>
- <msgCorrelated flightIndex="368694">
- <asdiMessage sourceFacility="KZMP" sourceTimeStamp="2008-10-27T18:38:45.0Z">
- <trackInformation>
.
.
.
.
.
_________________
IBM Certified Specialist - WebSphere MQ Integrator
IBM Certified System Administrator - WebSphere MQ V5.3
IBM Certified System Administrator - WebSphere Business Integration Message Broker V5
Back to top
View user's profile Send private message Yahoo Messenger
kimbert
PostPosted: Fri Nov 14, 2008 1:49 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Both asdiOutputCorrelated and msgCorrelated are in the namespace 'http://tfm.faa.gov/tfms/TFMS_XIS'. You need to declare a namespace constant and use it to qualify both elements in your field reference.

By the way, if you were intending to use a counted loop based on the result of CARDINALITY(...) then you should consider using a reference instead. This message flow may not need the performance benefits, but it's a good habit to acquire. Apologies if you were not intending to do any such thing
Back to top
View user's profile Send private message
solomita
PostPosted: Fri Nov 14, 2008 2:55 pm    Post subject: Like this? Reply with quote

Voyager

Joined: 06 May 2003
Posts: 94

DECLARE R REFERENCE TO http://tfm.faa.gov/tfms/TFMS_XIS;
DECLARE J Integer;
SET J = CARDINALITY(InputRoot.XMLNSC.R:asdiOutputCorrelated.R:msgCorrelated[]);

should there be single quotes around http://tfm.faa.gov/tfms/TFMS_XIS
_________________
IBM Certified Specialist - WebSphere MQ Integrator
IBM Certified System Administrator - WebSphere MQ V5.3
IBM Certified System Administrator - WebSphere Business Integration Message Broker V5
Back to top
View user's profile Send private message Yahoo Messenger
kimbert
PostPosted: Fri Nov 14, 2008 3:16 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

That was not what I meant at all. You declare a namespace constant like this:
Code:
DECLARE R NAMESPACE 'http://tfm.faa.gov/tfms/TFMS_XIS';

You obviously don't know what a REFERENCE is, so please ignore my second remark. When you get the time, you should read the ESQL reference and look at some examples from the samples gallery.
Back to top
View user's profile Send private message
solomita
PostPosted: Fri Nov 14, 2008 4:36 pm    Post subject: Reply with quote

Voyager

Joined: 06 May 2003
Posts: 94

I do know what a reference is and have used them before...its namespace references I am not as familiar with. Once you declare the namespace, what should this line then be modified to look like:

SET J = CARDINALITY(InputRoot.XMLNSC.asdiOutputCorrelated.msgCorrelated[]);
_________________
IBM Certified Specialist - WebSphere MQ Integrator
IBM Certified System Administrator - WebSphere MQ V5.3
IBM Certified System Administrator - WebSphere Business Integration Message Broker V5
Back to top
View user's profile Send private message Yahoo Messenger
kimbert
PostPosted: Fri Nov 14, 2008 5:07 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I have never used the term 'namespace reference'.

Please enter 'namespaces' in the search tool for the product documentation. There is a serious gap in your knowledge, and it's not our job to fill that for you.
Back to top
View user's profile Send private message
solomita
PostPosted: Fri Nov 14, 2008 6:35 pm    Post subject: Reply with quote

Voyager

Joined: 06 May 2003
Posts: 94

I am simply looking for help with the cardinality issue I am having. If you could please just post the code I would need to make this work that would be appreciated.....this is a time sensitive customer issue. Thank you.

So would it look like this:

DECLARE space1 NAMESPACE 'http://tfm.faa.gov/tfms/TFMS_XIS';
SET OutputRoot.XMLNSC.asdiOutputCorrelated.(XMLNSC.NamespaceDecl)xmlns = 'http://tfm.faa.gov/tfms/TFMS_XIS';

SET J = CARDINALITY(InputRoot.XMLNSC.space1:asdiOutputCorrelated.space1:msgCorrelated[]);
_________________
IBM Certified Specialist - WebSphere MQ Integrator
IBM Certified System Administrator - WebSphere MQ V5.3
IBM Certified System Administrator - WebSphere Business Integration Message Broker V5
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Sat Nov 15, 2008 2:51 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

solomita wrote:
this is a time sensitive customer issue.


Then you should raise a PMR with IBM. The forum has no SLA with posters.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sat Nov 15, 2008 4:05 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Holly -
It really did function with *, as I suggested in Sametime...

That said, I also got it working with a namespace prefix. Both of these two produce the correct result when I run them through a test flow.

Code:

      DECLARE ns1 NAMESPACE 'http://tfm.faa.gov/tfms/TFMS_XIS';
      SET Environment.Variables.Count1 = CARDINALITY(InputRoot.XMLNSC.*:asdiOutputCorrelated.*:msgCorrelated[]);
      SET Environment.Variables.Count2 = CARDINALITY(InputRoot.XMLNSC.ns1:asdiOutputCorrelated.ns1:msgCorrelated[]);
Back to top
View user's profile Send private message
solomita
PostPosted: Sat Nov 15, 2008 4:56 am    Post subject: Reply with quote

Voyager

Joined: 06 May 2003
Posts: 94

thanks jeff...will have to try again as it didn't work for me the first time but I also think i forgot to declare the namespace. Will give it a try on Mon!
_________________
IBM Certified Specialist - WebSphere MQ Integrator
IBM Certified System Administrator - WebSphere MQ V5.3
IBM Certified System Administrator - WebSphere Business Integration Message Broker V5
Back to top
View user's profile Send private message Yahoo Messenger
fjb_saper
PostPosted: Sat Nov 15, 2008 8:36 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Be careful when using namespace wildcards. The results Jeff got happen to be the same. However if you had an instance of msgCorrelated in a different namespace the results of Jeff's 2 queries would be different (Count1 <> Count2). Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Sat Nov 15, 2008 1:20 pm    Post subject: L Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I do not recommend using * instead of a proper namespace constant.
I do recommend following the product documentation which spells out, with clear examples, exactly what you need to do : http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ac67194_.htm

I am reluctant to simply copy and paste code samples from the documentation. I would rather have you learn something useful. Your next project will probably use namespaces too.
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 » CARDINALITY and XMLNSC
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.