Hitachi Vantara Pentaho Community Wiki
Skip to end of metadata
Go to start of metadata

Description

The Formula step can calculate Formula Expressions within a data stream. It can be used to create simple calculations like [A]+[B] or more complex business logic with a lot of nested if / then logic.


When you press on the Formula cell entry, the formula editor window opens and gives you help on the available functions:


The formula editor window does a direct check on the syntax and the field names supplied. In case of an error you get the error message direct, for instance:

  • No labels

2 Comments

  1. user-cc1ad

    *** Don't get Burned ***

    Excerpt from the PDI Forum from Tony...

    The functions in the formula step don't act like functions in java/javascript/etc. - and you can't assume that functions return -1 codes on failure. So sometimes you have to use the "Informational" functions to evaluate the results.

    In your case you can use this modified version to get what you want:

    IF(ISERR(FIND("z";"abcabc")); "POOP";"NOT POOP")

    Here the ISERR function checks for an error from the FIND function evaluation and converts it into a boolean result for evaluation in the IF statement.

    Don't expect this to act like Javascript. It is a different animal...

  2. @Kent: Thanks for the sample, it is similar to the sample_find.ktr attached to http://jira.pentaho.com/browse/PDI-1241 (using the ISERROR instead the ISERR)