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:
*** 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...
@A L:
> The page [http://wiki.pentaho.com/display/Reporting/Formula+Expressions|display/Reporting/Formula+Expressions] says the formula's are not for PDI!
It only states, that you must not start the formula with a "=", that's the difference.
@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)
The page http://wiki.pentaho.com/display/Reporting/Formula+Expressions says the formula's are not for PDI!