|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Formatting output tags |
« View previous topic :: View next topic » |
Author |
Message
|
LH33 |
Posted: Tue Nov 04, 2003 5:50 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Nov 04, 2003 11:33 am Post subject: |
|
|
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 |
|
 |
LH33 |
Posted: Tue Nov 04, 2003 11:37 am Post subject: |
|
|
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 |
|
 |
|
|
|
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
|
|
|
|