Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: How to implement If Else statement in Metadata Editor?

  1. #1

    Talking How to implement If Else statement in Metadata Editor?

    we tried like this,
    IF STATUS=1 THEN 'ACTIVE' ELSE 'INACTIVE

    but we got the query like this,

    SELECT DISTINCT
    BT_RESOURCECATEGORY_RESOURCE01."IF STATUS=1 THEN 'ACTIVE' ELSE 'INACTIVE'" AS COL0
    FROM
    RAMS.RESOURCECATEGORY BT_RESOURCECATEGORY_RESOURCE01
    ,RAMS.RESOURCETYPE BT_RESOURCETYPE_RESOURCETYPE
    WHERE
    ( BT_RESOURCECATEGORY_RESOURCE01.TYPE_ID = BT_RESOURCETYPE_RESOURCETYPE.ID )
    AND
    (
    (
    BT_RESOURCETYPE_RESOURCETYPE."VALUE" = 'Software'
    )
    )

    Here the if statement is appearing after the table name.

    Please Advice how to resolve this issue!!!

  2. #2
    Join Date
    Dec 2009
    Posts
    332

    Default

    What type of database (MySQL, SQLServer, progress, Oracle)?

  3. #3

    Default

    We are working in IBM DB2 7.5 &
    Pentaho 3.6

  4. #4
    Join Date
    Apr 2010
    Posts
    26

    Default

    you should check the 'Is the Formula Exact' box to prevent metadata editor from prefixing the table name and quoting it.

    Another thing you should do is putting the table name before the field in your formula just in case there is more than one STATUS field in the metadata.

  5. #5
    Join Date
    Nov 2010
    Posts
    19

    Default

    You should use the CASE function.

    http://wiki.pentaho.com/display/Serv...adata+Formulas

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.