Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Help required in variable definition

  1. #1

    Question Help required in variable definition

    Hi,

    I am new to Data Integration. I have a text file which contains values in the following format :

    ******
    field1:value
    field2:value
    field3:value
    ******
    field1:value
    field3:value
    ******

    I have to load this content into a database table which has field1, field2, field3.

    I have to use a row denomalizer to achieve this, but I have to create a grouping column something like this.

    rownum,fieldname,value
    1,field1,value
    1,field2,value
    1,field3,value
    2,field1,value
    2,field3,value

    I tried it with a Modified Javascript step. I have created one variable and tried to increment when there is the delimiter value("******") in the stream. The variable is not getting incremented since the variable is getting defined each time. I tried creating a job with set variable option and scope as current job. But I couldn't handle the variable in the javascript using getvariable and setvariable option. Can anyone throw some light on this?

    Thanks and Regards,
    Subbu S

  2. #2

    Default

    Subbo
    Modified Javscript variables are persistent between rows, so you can capture the fields and use your ("******") rows to summarise what has been captured.
    Attached is a transformation which reads in your file and does just this.
    test.ktr
    Tony
    Tony, Cloud2Land.com

    Get the latest snapshot Pentaho Data Integration (Kettle) builds from SVN on my blog!
    http://www.cloud2land.com/

  3. #3

    Default

    Thanks Tony for your timely help.

    It worked for me.

    Regards,
    Subbu S

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.