Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: How to generate an listIndex on the fly

  1. #1
    Join Date
    Feb 2007
    Posts
    10

    Default How to generate an listIndex on the fly

    Hello,
    could anyone please help me with a basic Spoon/Kettle transformation?

    I have a legacy datamodel where there are a column previously used for sorting entities called sortOrder.

    Example:
    Object A have a set of B's in a ordered manner.

    In Hibernate I need a listIndex column in the database for the array of B's

    My problem is that the quality of the sortOrder column is really bad, and in many cases does not carry any information (i.e. all values are 0) regarding ordering.

    So I need to generate a new index/sequence for each A and assign this on the fly to the groups of B's.

    Any ideas?

    best regards,
    Lars

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Sort and add a sequence?

  3. #3
    Join Date
    Feb 2007
    Posts
    10

    Default

    Yes, for each new A there is a set of B's. Whenever I load an A I need to create an index/sequence for every B belonging to the A.

    The A column is a relation/FK to another table in B.

    A1, B1
    A1, B2
    A1, B3
    A2, B1
    A2, B2
    A3, B1
    etc.


    and i need

    A1, B1, 0
    A1, B2, 1
    A1, B3, 2
    A2, B1, 0
    A2, B2, 1
    A3, B1, 0

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    Check out group by step.

    Regards,
    Sven

  5. #5
    Join Date
    Feb 2007
    Posts
    10

    Default

    Thanks, got it working like a dream.

    /Lars

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.