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 » Check to see if Child field exists

Post new topic  Reply to topic
 Check to see if Child field exists « View previous topic :: View next topic » 
Author Message
kytem
PostPosted: Tue Jan 19, 2010 10:03 pm    Post subject: Check to see if Child field exists Reply with quote

Newbie

Joined: 06 Dec 2009
Posts: 7

I have a schema that can have two possible child elements (each with subsequent child elements)

B2BMessage/payload/loadTimetableData/TimetableDataUploadType/TimetableUpload

or

B2BMessage/payload/loadTimetableData/TimetableDataUploadType/STNUpload

I want to be able to identify what the child is to determine the output message format and destination. I'm using the IF statement below, but its not identifying the child element correctly.

See the code fragment below...If I send in test data which is "STNUpload" or "TimetableUpload" the IF statements are not entered, and I don't understand why? I've tried with = NULL, IS NULL, etc... and I've had no joy.

What am I doing wrong?


IF InputTree.XMLNSC.B2BMessage.payload.loadTimetableData.TimetableDataUploadType.TimetableUpload IS NOT NULL THEN
RETURN 'TIMETABLE';
ELSEIF InputTree.XMLNSC.B2BMessage.payload.loadTimetableData.TimetableDataUploadType.STNUpload IS NOT NULL THEN
RETURN 'STN';
END IF;

Thanks
Back to top
View user's profile Send private message
flahunter
PostPosted: Tue Jan 19, 2010 11:03 pm    Post subject: Reply with quote

Acolyte

Joined: 30 Oct 2008
Posts: 62

Have you set the domain as "XMLNSC"?
Back to top
View user's profile Send private message
francoisvdm
PostPosted: Tue Jan 19, 2010 11:05 pm    Post subject: Reply with quote

Partisan

Joined: 09 Aug 2001
Posts: 332

One way of doing it is:
Code:

DECLARE pPoint REFERENCE TO InputRoot.XMLNSC.B2BMessage.payload.loadTimetableData.TimetableDataUploadType.TimetableUpload;
IF LASTMOVE(pPoint) THEN
.....
ELSE
....
END IF;
[/code]
_________________
If you do not know the answer or you get the urge to answer with "RTFM" or "Search better in this forum", please refrain from doing so, just move on to the next question. Much appreciated.

Francois van der Merwe
Back to top
View user's profile Send private message Send e-mail
SOLOHERO
PostPosted: Tue Jan 19, 2010 11:09 pm    Post subject: Reply with quote

Centurion

Joined: 01 Feb 2007
Posts: 107

You can use simple check using EXISTS function

eg.
Code:
IF EXISTS(InputBody.B2BMessage.payload.loadTimetableData.TimetableDataUploadType.TimetableUpload[])
         THEN
            RETURN 'TIMETABLE';
         ELSE
            RETURN 'STN';
         END IF;




Eg2:

Code:
IF NOT EXISTS(InputBody.B2BMessage.payload.loadTimetableData.TimetableDataUploadType.TimetableUpload[])
         THEN
            RETURN 'STN';
         ELSE
            RETURN 'Timetable';
         END IF;




Hope this helps...
_________________
Thanks
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 » Check to see if Child field exists
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.