Duplicates issue in XML OUTPUT STAGE to generate xml

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
tanmaya
Participant
Posts: 38
Joined: Tue Jun 16, 2009 7:57 am
Location: Bangalore

Duplicates issue in XML OUTPUT STAGE to generate xml

Post by tanmaya »

Hi,

I am using XML output stage to generate an xml file. I am able to generate the xml file also but the issue is with the structure of the xml file.

Below are a sample records for which the xml file was generated.

1) "100256","Dsm","410","E","A"
2) "100257","Dsm","410","E","A"
3) "100260","Dsm Ii","412","E","A"

The sample of the xml generated was like given below.If you see the xml generated it shows that it has clubbed together the tags for the code 100256 and 100257, Is is probably because they have all of there other associated values same. Please help me out with this issue as I want it to generate seperate xml tags for both of them like the one created for code 100260.

<ns1:updateRequest>
<ns1:jobList>
<ns1:job>
<ns1:code>100256</ns1:code>
<ns1:code>100257</ns1:code>
<ns1:description>Dsm</ns1:description>
<ns1:salaryPayGrade>410</ns1:salaryPayGrade>
<ns1:flsaStatus>E</ns1:flsaStatus>
<ns1:effectiveStatus>A</ns1:effectiveStatus>
</ns1:job>
<ns1:job>
<ns1:code>100260</ns1:code>
<ns1:description>Dsm Ii</ns1:description>
<ns1:salaryPayGrade>412</ns1:salaryPayGrade>
<ns1:flsaStatus>E</ns1:flsaStatus>
<ns1:effectiveStatus>A</ns1:effectiveStatus>
</ns1:job>
</ns1:jobList>
</ns1:updateRequest>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

A strange issue indeed. I've found that the easiest way to alleviate this is to ensure that the sub-elements cannot be the same. Add another element as an immediate sub-node and then edit it out afterwards in a downsteam transformer, by sending your output to a single column on the output link...a varchar with large length and just a single "/" in the Description property.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
tanmaya
Participant
Posts: 38
Joined: Tue Jun 16, 2009 7:57 am
Location: Bangalore

Post by tanmaya »

Hi Ernie,

Can you please ellaborate on the way in which after adding a new field and then generating a xml how is it possible to remove that extra column. from the generated xml.
If I am getting this wrong please correct me.

Thanks,
Tanmaya
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

...there are lots of great string functions in a BASIC Transformer, or...just do the whole Job in a Server Job instead and use a regular transformer....I'd have to see your actual resulting string, but I'll be that a couple of nested ereplace()'s would work just fine.....

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

I assume you have xpaths defined for each of these columns? Please can you post them? Including named spaces (NS1:) in your output can be tricky, so you have to be pretty specific at what you're trying to achieve. Setting your "code" column as the repeating group column should resolve your grouping problem.

Try generating your data using XPATH without names spaces e.g
/updateRequest/jobList/job/code
/updateRequest/jobList/job/code/description
etc.

Once you have this working, attempt a version 2 to solve your named space issue.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
Post Reply