Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: How can I do a simple select max(column) from table query to start a sequence?

  1. #1
    Join Date
    Jan 2011
    Posts
    21

    Default How can I do a simple select max(column) from table query to start a sequence?

    I have a really simple task that has me blocked. I want to select max(rolodex_id) from rolodex before I insert new rows so I know where to start my transform sequence number. Then I want to use that result to create a sequence which starts from the result + 1.

    I can't seem to find a command to do this. Execute SQL script doesn't seem to return a result, Execute row SQL script doesn't look right, call DB proc of course calls a proc. Is there a simple "Run a select statement" option.

    "Table input" lets me run a query but I can't seem to figure out where to put it. If I put it in my stream it breaks the stream of data and replaces with one value since the result of this query is one row.

    I am sure I am missing something obvious here but can't seem to figure it out.

  2. #2
    Join Date
    Nov 2008
    Posts
    143

    Default

    Hi,

    You can either use a combo of steps:

    Code:
    [Main stream]
          |
          V
    [Join Rows (cartesian product)]  <- [Table input (Select max(col) From table]
          |
          V
    [Add sequence]
          |
          V
    [Calculate id (max + sequence)]
          |
          V
    [Continue processing]

    Or use a Dimension lookup/update step.

    I prefer the combo, because it seems lighter, but I haven't done any profiling, yet.

    HTH,

    Renato

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.