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 » Formatting output tags

Post new topic  Reply to topic Goto page Previous  1, 2
 Formatting output tags « View previous topic :: View next topic » 
Author Message
LH33
PostPosted: Tue Nov 04, 2003 5:50 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2002
Posts: 200

Great!! Thank you!

I've tried referencing the first street and going from there, but if I use input XML that has nulls for all the Street[1] data, the output still shows up in street[1] instead of street[2].
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Nov 04, 2003 11:33 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay. This seems to work.

Notice it has nothing to do with my earlier suggestions. My apologies for that.

Code:
set streetsExists= CARDINALITY(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.*[]);
set Environment.Variables.streetCounter = 1;

if (streetsExist < 1) then
   Set OutputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[1] =
      row('1' as (XML.Attribute)"index",
         '' as "Article",
         '' as "Direction",
         '' as "Type",
         '' as "Name");
   Set OutputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[2] =
          row('2' as (XML.Attribute)"index",
         '' as "Article",
         '' as "Direction",
         '' as "Type",
         '' as "Name");
else
   set OutputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[1] =
      row('1' as (XML.Attribute)"index",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[1]."Article",'') as "Article",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[1]."Direction",'') as "Direction",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[1]."Type",'') as "Type",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[1]."Name",'') as "Name");
   Set OutputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[2] =
          row('2' as (XML.Attribute)"index",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[2]."Article",'') as "Article",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[2]."Direction",'') as "Direction",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[2]."Type",'') as "Type",
         Coalesce(InputRoot.XML.ChangeJob.DataArea.Job.Location.Address.Streets.Street[2]."Name",'') as "Name");
         
end if;


I am making some assumptions about your data here. The first is that there are only ever going to be two Street children of Streets. The second is that there is only one Job, one Location, and one Address element. If there are more of any of those, you'll have to take that into account and work with Job[x], or whatever.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
LH33
PostPosted: Tue Nov 04, 2003 11:37 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2002
Posts: 200

I can't thank you enough!!! I'm going to put this in now and test all my scenarios. Your asumptions on the data are correct.

THANKS!!!!! Lisa
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Formatting output tags
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.