|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Missing index |
« View previous topic :: View next topic » |
Author |
Message
|
LH33 |
Posted: Sat Aug 30, 2003 7:10 am Post subject: Missing index |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I have a message flow that needs to transform an indexed tag where the index = 2.
In the XML transaction, the tag for index = 1 is not there. In this example, I need to take the input tag <UDF index="2">POLEWORK</UDF> and set the output tag to <UDF index="2">MAINTENANC</UDF>.
Her is my code:
DECLARE UDFS2 CHAR;
SET UDFS2 = THE ( SELECT ITEM R FROM
InputRoot.XML.SyncJob.DataArea.Job.UDFS.UDF[] as R where
R.(XML.Attribute)index = '2');
SET OutputRoot.XML.SyncJob.DataArea.Job.UDFS.UDF[2] =
CASE UDFS2
WHEN 'POLEWORK' THEN 'MAINTENANC'
WHEN 'MTR/LOOP' THEN 'MAINTENANC'
WHEN 'SECDFAULT' THEN 'MAINTENANC'
END;
Here is my input XML:
<SyncJob revision="1.0.0" environment="Test">
<DataArea>
<Job>
<JobNumber>EOM-20030715-0002</JobNumber>
<UDFS>
<UDF index="2">POLEWORK</UDF>
</UDFS>
<WorkCodeUDFS>
<WorkCodeUDF index="77">Y</WorkCodeUDF>
</WorkCodeUDFS>
</Job>
</DataArea>
</SyncJob>
The output that I get is as follows:
<SyncJob revision="1.0.0" environment="Test">
<DataArea>
<Job>
<JobNumber>EOM-20030715-0002</JobNumber>
<UDFS>
<UDF index="2">POLEWORK</UDF>
<UDF>MAINTENANC</UDF></UDFS>
<WorkCodeUDFS>
<WorkCodeUDF index="77">Y</WorkCodeUDF>
</WorkCodeUDFS>
</Job>
</DataArea>
</SyncJob>
What I need it to be is:
<SyncJob revision="1.0.0" environment="Test">
<DataArea>
<Job>
<JobNumber>EOM-20030715-0002</JobNumber>
<UDFS>
<UDF index="2">MAINTENANC</UDF>
</UDFS>
<WorkCodeUDFS>
<WorkCodeUDF index="77">Y</WorkCodeUDF>
</WorkCodeUDFS>
</Job>
</DataArea>
</SyncJob>
Can someone help to see what I need to do.
Thanks, Lisa |
|
Back to top |
|
 |
kirani |
Posted: Sat Aug 30, 2003 7:19 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
You need to select copy entire message in yourcompute node and then use following code to overwrite the value in the output tree
Code: |
SET OutputRoot.XML.SyncJob.DataArea.Job.UDFS.UDF =
CASE UDFS2
WHEN 'POLEWORK' THEN 'MAINTENANC'
WHEN 'MTR/LOOP' THEN 'MAINTENANC'
WHEN 'SECDFAULT' THEN 'MAINTENANC'
END;
|
Now, it will be tricky if you have multiple occurances of <UDF> tags in your message because you would like to update one specific occurance. You may have to find the index first before updating that tag. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
LH33 |
Posted: Sun Aug 31, 2003 9:56 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Kiran,
I had the Copy Entire Message checked and also had the code that you suggested. It appears that since the first index is not present in the XML, that the Message flow thinks the second one is the first. So, I set the tag with index = 1 to MAINTENANC and then gave it an XML.Attribute of index = 2 and it works fine.
Thanks!! Lisa |
|
Back to top |
|
 |
kirani |
Posted: Mon Sep 01, 2003 7:53 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
The tag <UDF index="2">POLEWORK</UDF> can come before or without <UDF index="1"> tag in your XML. Here, index is just an XML attribute, it's not an index of occurance or repeated XML tag. XML doesn't force these attributes to be numbered in sequential order. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
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
|
|
|
|