Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: How to loop through a ResultSet

  1. #1

    Default How to loop through a ResultSet

    Is there a way to execute an SQL and parse the ResultSet per transformation?

    I'm reading reacords from a DB and I would like to run a RegEx on a specific field from the Table.
    The problem is that I have multiple RegExpressions that I would like to "unleash" on every record.

    So basically I'm trying to create some kind of a RuleEngine, where I can store my rules (RegEx) in a separate table and when parsing an input file, run every rule from the RuleEngine on the parsed record.

    Is this even possible?
    Any help would be greatly appreciated!!

  2. #2
    Join Date
    Sep 2009
    Posts
    810

    Default Example

    I've attached an example that might get you in the right direction. It uses a JS step that pulls the rules from the database and applies each rule to each passing record. If you need clarification on the JS step workings, I'd recommend looking at these posts

    http://type-exit.org/adventures-with...entaho-kettle/
    http://type-exit.org/adventures-with...entaho-kettle/

    Be sure not to miss what happens in the Initialization tab of the script.

    I've included a small dump of the mysql db I was testing with

    Cheers

    Slawo
    Attached Files Attached Files

  3. #3

    Default

    Thanks a lot Slawo... that worked out perfectly!!!
    Didn't know there was such a thing like "Start" and "End Script"...

    I see a LOT of potential in PDI... but it's a shame there is no documentation, books,... for advanced tranformations.

    Anyway... thanks again!! may all your ups and downs be in bed!!

  4. #4
    Join Date
    Sep 2009
    Posts
    810

    Default

    You're welcome ;-)

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 - 2017 Pentaho Corporation. All Rights Reserved.