|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Check to see if Child field exists |
« View previous topic :: View next topic » |
Author |
Message
|
kytem |
Posted: Tue Jan 19, 2010 10:03 pm Post subject: Check to see if Child field exists |
|
|
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 |
|
 |
flahunter |
Posted: Tue Jan 19, 2010 11:03 pm Post subject: |
|
|
 Acolyte
Joined: 30 Oct 2008 Posts: 62
|
Have you set the domain as "XMLNSC"? |
|
Back to top |
|
 |
francoisvdm |
Posted: Tue Jan 19, 2010 11:05 pm Post subject: |
|
|
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 |
|
 |
SOLOHERO |
Posted: Tue Jan 19, 2010 11:09 pm Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|