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 » Problem in checking no of occurences with 'MRM' domain

Post new topic  Reply to topic
 Problem in checking no of occurences with 'MRM' domain « View previous topic :: View next topic » 
Author Message
sirisha.n
PostPosted: Thu Aug 21, 2008 4:19 am    Post subject: Problem in checking no of occurences with 'MRM' domain Reply with quote

Apprentice

Joined: 25 Feb 2008
Posts: 27

Hi,

I need to check the no of occurences of a child element in the xml message. i have tried with cardianlity function. i can able to retrive the no of occurences successfully.

DECLARE ItemNumCounter INTEGER;
ItemNumCounter=CARDINALITY(InputRoot.XML.N_PRIface.Content.N_PR.PR.PRLINE[]);

But, if the input message type is of 'MRM' , its giving warning and unable to deploy.

please suggest, is there any other way to check the no of occurences with 'MRM' domain.
Back to top
View user's profile Send private message
sridhsri
PostPosted: Thu Aug 21, 2008 5:21 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

cardinality should work with MRM too. I guess you are just replacing XMl with MRM. That might not work. While using the XML parser, you need to specify the Root element (Ex: OutputRoot.XML.RootElement.Element). But when using MRM you don't (Ex: OutputRoot.MRM.Element). Perhaps that explain why you didn't get the results you expected.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Aug 21, 2008 5:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I need to check the no of occurences of a child element in the xml message
If you are trying to validate your XML, you should be using a message set, and enabling validation in your message flow. And you should be using XMLNSC, not the ( deprecated ) XML domain.
If you are trying to write a loop which processes each occurrence of PRLINE then you should be using references, not a loop counter.
Back to top
View user's profile Send private message
paranoid221
PostPosted: Thu Aug 21, 2008 2:50 pm    Post subject: Reply with quote

Centurion

Joined: 03 Apr 2006
Posts: 101
Location: USA

I concur with kimbert's view
But if there is a genuine reason/requirement as to why you need to know the number of children, you could do something like this in JavaCompute Node.
Quote:
NOTE: Assuming you are in MRM domain

MbMessage inMessage = contact admin.getMessage();
MbElement inMsgBody = inMessage.getRootElement().getLastChild();
int ItemNumCounter = inMsgBody.evaluateXPath("Content/N_PR/PR/PRLINE").size();

Had a Typo and had to edit the original
Back to top
View user's profile Send private message
siva.kasetty
PostPosted: Thu Aug 21, 2008 10:43 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Mar 2008
Posts: 45

Hi Kimbert,

I need to set a sequence number to a field in the output. This sequence depends on the number of occurences of PRLINE field in the input. When I use the input message set, the following line gives a warning:

SET ItemNumCounter=(InputRoot.MRM.Q1:Content.Q1:N_PR.Q1:PR.Q1:PRLINE[]);

as it is not accepting [] at the end. It does not give warning without [], but it will not get deploy without [].

As per the requirements, I have to use MRM for the input message. But I foudn that the followign line does not give any error/warning:

DECLARE ItemNumCounter INTEGER CARDINALITY(InputRoot.XML.N_PRIface.Content.N_PR.PR.PRLINE[]);

Can you pls tell, how do we find the CARDINALITY of PRLINE field in the input message when we use the MRM domain. OR Is there some other way of finding the occurences of a particular field in the input message?

We are using WMB V 6.0.2
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Aug 22, 2008 12:54 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I need to set a sequence number to a field in the output
That's an excellent reason for wanting to get the number of occurrences.
Quote:
how do we find the CARDINALITY of PRLINE field in the input message when we use the MRM domain
The same way as for any other domain, with one small caveat. Supply the field reference to the CARDINALITY function. As mentioned above. MRM field references do not contain the root element.
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 » Problem in checking no of occurences with 'MRM' domain
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.