Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: [Loop] Need some help building a loop job / transformation

  1. #1
    Join Date
    Jul 2011
    Posts
    21

    Default [Loop] Need some help building a loop job / transformation

    I am trying to get this done, but I'm having some difficulties which I don't know how to solve, yet.

    I have a list of categories ids in a text file, named cat_ids.csv. For example:
    001
    123
    654
    etc.

    I have a second file with all products in it, and also a category_id which is 'linked' to the category id's in the other file. For example:
    product A | 001
    product B | 001
    product C | 123
    product D | 654
    (this products.csv contains around 80 000 products)

    What I want to achieve is to loop through all categories and get the first 10 products within that category.

    Basiscally, it's working except for the part where the loop is suppossed to be.

    How can I do this with a job?

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

    Default

    I'm not sure if you really need the file cat_ids.csv, but it would be an inner join if you do.
    Make sure both files are sorted by cat_id, anyway.
    Add a grouped sequence number to the product CSV file using step "Add value fields changing sequence" and filter all rows with a sequence number less than 11.
    Voila.
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Jul 2011
    Posts
    21

    Default

    Quote Originally Posted by marabu View Post
    I'm not sure if you really need the file cat_ids.csv, but it would be an inner join if you do.
    Make sure both files are sorted by cat_id, anyway.
    Add a grouped sequence number to the product CSV file using step "Add value fields changing sequence" and filter all rows with a sequence number less than 11.
    Voila.
    Wow! That's a pretty neat step! Thanks for your help. Looping isn't necessary anymore in this case. Thanks again.

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.