Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Add record to XML Output one by one.

  1. #1

    Default Add record to XML Output one by one.

    Hi All,

    I have a job like this

    start -----> transformation1 ---> transformation2

    transformation2 is executed for every input row.

    In transformation1 i am selecting the student_id and copy rows to results.

    In transformation2 i am doing "Get rows from results"
    Also in transformation2 i am handling the error and when error occurs i am storing this student_id in xml file.

    I am able to create a xml file with "XML Output" step.
    The problem i am facing is each time in the xml file the record is not added, its overriding the record.

    ex: i want to add say student_id one by one to xml file if error occurs .
    for 1st student xml file will be

    <Rows>
    <Row><student_id>1</student_id></Row>
    </Rows>

    for 2nd student it should be

    <Rows>
    <Row><student_id>1</student_id></Row>
    <Row><student_id>2</student_id></Row>
    </Rows>


    for 3rd student it should be

    <Rows>
    <Row><student_id>1</student_id></Row>
    <Row><student_id>2</student_id></Row>
    <Row><student_id>3</student_id></Row>
    </Rows>

    The final xml should look like the below one.

    but at present i am get the xml file like this

    <Rows>
    <Row><student_id>3</student_id></Row>
    <Row><student_id>3</student_id></Row>
    <Row><student_id>3</student_id></Row>
    </Rows>

    Please help me.

    Regards,
    Sham
    Last edited by sham; 08-11-2010 at 06:55 AM.

  2. #2
    Join Date
    Sep 2009
    Posts
    810

    Default

    Would you like to create a minimal sample that shows this behavior? Having something concrete to work with makes it simpler to suggest a solution

    Cheers

    Slawo
    Last edited by slawomir.chodnicki; 08-11-2010 at 12:06 PM. Reason: Typo

  3. #3

    Default

    Hi All,

    I have a job like this

    start -----> transformation1 ---> transformation2

    transformation1 is executed once.
    transformation2 is executed for every input row.

    transformation1 :
    In transformation1 i am selecting the student_id and copy rows to results.

    Table Input ---> copy rows to results.

    query used in Table Input : select student_id from student;

    In transformation2 i am getting this student_id with the help of "Get rows from results" step.

    Using this student_id i am transferring the data from different tables (source database ) to the tables in destination database.

    Also in transformation2 i am handling the error and when error occurs i want to store the student_id in xml file.

    I am able to create a xml file with "XML Output" step.
    The problem i am facing is each time in the xml file the student_id is not added, its overriding the with the last student_id.

    ex: i want to add say student_id one by one to xml file if error occurs .

    if i have 100 student_id in student table and for three students error has occurred say student_id - 5,6,9.

    i am getting the xml file as below:

    <Rows>
    <Row><student_id>9</student_id></Row>
    <Row><student_id>9</student_id></Row>
    <Row><student_id>9</student_id></Row>
    </Rows>

    The final xml file that i want should look like the below one.

    <Rows>
    <Row><student_id>5</student_id></Row>
    <Row><student_id>6</student_id></Row>
    <Row><student_id>9</student_id></Row>
    </Rows>

    Please help me.

    Regards,
    Sham

Tags for this Thread

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.