Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Step after negative Switch/Case shouldn't be executed but is

  1. #1
    Join Date
    Aug 2010
    Posts
    4

    Default Step after negative Switch/Case shouldn't be executed but is

    Hello,

    I have a switch/case step (the upper left one in the picture called "All nodes or list") and in case a variable has the value "all" the database connection step (called "Get all nodes out of database") should be executed, otherwise the "Add control constant" step to the right.

    The problem is now that no matter what the value of the variable is, the parallel executing of Kettle Steps causes the database connection step being executed in any case.

    I do not want that because it is simply a waste of time. But how can I hinder the step from executing? If I check the "Insert data from step" option giving the switch/case step as the step inserting data there comes an error message like expecting parameters from previous step but none given...

    Do you have any ideas?

    Here the screenshot of the transformation:

    Name:  Switch_Case_Database.jpg
Views: 80
Size:  18.9 KB

    I am using PDI 4.0.0

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

    Default

    Did you check the "execute for every input row" option?

  3. #3
    Join Date
    Aug 2010
    Posts
    4

    Default

    Quote Originally Posted by MattCasters View Post
    Did you check the "execute for every input row" option?
    No, I did not

    Thank you, now it is running the way I intended

    It does because the database connection step now awaits the input, right? Even if it does nothing but ignoring the input row xD

    But I have a question concerning the "execute for every input row" option - in this case I only have one single input row from the previous step. If I had more than one, would the database connection step execute once for every row? Where lies the sence of that? Can one evolve the input rows in the databse connection steps? I just know the way with the variables...

  4. #4
    Join Date
    Nov 2008
    Posts
    143

    Default

    Quote Originally Posted by gutlez View Post
    ${variable} is a constant which can be changed before this run of the tranformation
    ? is a parameter which may vary between rows.

    ? is allowed in where clauses, but not database or table names
    ${variable} is allowed anywhere.

    If ? is something that needs formatting (string, date, etc), your JDBC driver is responsible for wrapping it correctly ( ' ', Date_Format, etc), which is where the quotes are coming from... This is not PDI doing it. If you want to change the Schema or Table Name in your select statement, you have to use ${variable}
    This might explain :-)

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

    Default

    Euh, the "Execute for every input row" option indeed executes a new query for each input row. For every input row the (optional) input values are used as parameters and then the query is executed. All the results of all the queries are passed on to the next steps.

    HTH,

    Matt

  6. #6
    Join Date
    Nov 2008
    Posts
    143

    Default

    Matt,

    I remember there was an issue on 3.2 concerning Table Inputs that id only passed on data retrieved from the query, but not the data that it received from previous steps.
    Do you know if this is intentional, or if it was fixed?

    Cheers,

    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.