Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Retrieving data from XML file

  1. #1
    Join Date
    Jan 2018
    Posts
    1

    Default Retrieving data from XML file

    Hello!


    The external system sends a XML file:


    <response>
    <deals>
    <deal>
    <name>deal_1</name>
    <stages>
    <stage status="opened">
    <amount>0</amount>
    </stage>
    <stage status="opened">
    <amount>0</amount>
    </stage>
    <stage status="finished">
    <amount>10</amount>
    </stage>
    </stages>
    </deal>
    <deal>
    <name>deal_2</name>
    <stages>
    <stage status="finished">
    <amount>20</amount>
    </stage>
    <stage status="finished">
    <amount>15</amount>
    </stage>
    </stages>
    </deal>
    <deal>
    <name>deal_3</name>
    <stages>
    <stage status="stoped">
    <amount>0</amount>
    </stage>
    </stages>
    </deal>
    <deal>
    <name>deal_4</name>
    <stages>
    <stage status="finished">
    <amount>50</amount>
    </stage>
    </stages>
    </deal>
    </deals>
    </response>


    I want to find Deals in which all Stages have "status"="finished". I want to find for each such Deal the amount by Stages.
    I want to get:


    name | amount_summary
    -------------------------------------------
    deal_2 35
    deal_4 50


    How is it better to do this in Pentano? How to draw in Spoon?
    Who can give an example in the .ktr file?


    Regards!

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    I would use a Get-Data-From-XML step for this.

    Set "Loop XPath" to something like //deal[count(stages/stage[@status!="finished"])=0]
    So long, and thanks for all the fish.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.