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
roydanlobo
Participant
Posts: 21
Joined: Mon Mar 01, 2010 4:55 pm

XML

Post by roydanlobo »

I loaded the data into ODBC tables and made some transformations and finally and putting in an XML,

In the output XML some of the child nodes has to repeat( I have multiple items coming in, one of the child note is item and it has to repeat)

Please help me.

thanks in advance.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Assuming that items are "beneath" customers or orders, then check the aggregation ootion and make item or something at its level a key and the grouping will happen automatically.
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
roydanlobo
Participant
Posts: 21
Joined: Mon Mar 01, 2010 4:55 pm

Post by roydanlobo »

I am sorry, the actual process is we have Orders(OrderLines(OrderLine))) . In single order there can be many OrderLine.

I used one of the coloum in OrderLine as key and even used as trigger in XML output.

Thanks in advance,
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: Help us out here. Post samples so we know what you are doing and attempting to do - XPath Expressions, Key, expected and actual output, settings in the stage, etc etc.

The trigger column is used to spool output to a new file every time it changes, that doesn't sound like something you need here. But then, when it comes down to it, we're all just guessing. So, help us help you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

From a private email sent to me.

:!: Roydanlobo, please do not do that again, post all responses and questions in the proper forum and/or thread, save the private emails for actual "private" stuffs. Thanks.
---------------------------------------------------

I have 4 inputs which are ODBC stages

1. PO table
2. Status table
3. View(created view by joining 4 tables)
4. Notes table.

My job is to look in the status table for un-processed PO's and have to look up in the other tables and get the data.
Output is an XML

For every PO there may be multiple order lines .

Output should look like,

Code: Select all

<Order BuyerOrganizationCode="011" Division="IO" DocumentType="" DraftOrderFlag="N" 
EnterpriseCode="" OrderName="" OrderNo="" OrderType="Normal" 
ReceivingNode="011" ReqDeliveryDate="2010-07-19" SellerOrganizationCode="" OrderDate="2010-07-12" 
EnteredBy="" ShipNode="">
  <OrderLines>
    <OrderLine OrderedQty="4.000" LineType="REGULAR" CostCurrency="USD">
      <Item CustomerItem="" CustomerItemDesc="" ItemID="78510" ItemDesc="OPTIONAL" 
      ItemShortDesc="OPTIONAL" UnitCost="22.5" UnitOfMeasure=""/>
      <Notes>
        <Note ReasonCode="Note"/>
      </Notes>
      <Extn ExtnVendorUOM="EA" ExtnMfrStockNum="CROAT0082-49"/>
    </OrderLine>
  </OrderLines>
  <OrderLines>
      <OrderLine OrderedQty="4.000" LineType="REGULAR" CostCurrency="USD">
        <Item CustomerItem="" CustomerItemDesc="" ItemID="78510" ItemDesc="OPTIONAL" ItemShortDesc="OPTIONAL" UnitCost="22.5" UnitOfMeasure=""/>
        <Notes>
          <Note ReasonCode="Note"/>
        </Notes>
        <Extn ExtnVendorUOM="EA" ExtnMfrStockNum="CROAT0082-49"/>
      </OrderLine>
  </OrderLines>
  <OrderLines>
      <OrderLine OrderedQty="4.000" LineType="REGULAR" CostCurrency="USD">
        <Item CustomerItem="" CustomerItemDesc="" ItemID="78510" ItemDesc="OPTIONAL" ItemShortDesc="OPTIONAL" UnitCost="22.5" UnitOfMeasure=""/>
        <Notes>
          <Note ReasonCode="Note"/>
        </Notes>
        <Extn ExtnVendorUOM="EA" ExtnMfrStockNum="CROAT0082-49"/>
      </OrderLine>
  </OrderLines>
</Order>
Thanks in Advance
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

looks like a nice relational implementation.....nested perfectly, unless I read it incorrectly. THis should be working just fine with aggregate and something in notes as your key.

if not...what "are" you getting?
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
roydanlobo
Participant
Posts: 21
Joined: Mon Mar 01, 2010 4:55 pm

Post by roydanlobo »

My issue is order lines are repeating.
roydanlobo
Participant
Posts: 21
Joined: Mon Mar 01, 2010 4:55 pm

Post by roydanlobo »

I am sorry, if a order has multiple lines it is showing only one order line
arunpramanik
Participant
Posts: 63
Joined: Fri Jun 22, 2007 7:27 am
Location: Kolkata

Post by arunpramanik »

roydanlobo wrote:I am sorry, if a order has multiple lines it is showing only one order line

I think you are using the aggregate option in the transformation settings.
Recently I faced the same issue, as the elements being grouped when there is a common value while using aggregate. And I have used a extra dummy element and populated the dummy with @OUTROWNUM making the rows identical. Hope this works for you also
Post Reply