US and Worldwide: +1 (866) 660-7555

# Thread: How to use the Formula step in the Pentaho data integration transformation

1. Junior Member
Join Date
Aug 2012
Posts
4

## How to use the Formula step in the Pentaho data integration transformation

Hi,

I am trying to write a formual and i am not able to use any of the functions available in that step. Am i missing something here on how to use it.

I want to use an IF ELSE condition where i have many conditions to check and it should result in a certain output if the condition is not met. it throws syntax errors many times.

please guide me on how to use this step.

Thanks,
Vineela.

2. Senior Member
Join Date
Jun 2012
Posts
1,443
Originally Posted by vineela
it throws syntax errors many times.
Since you don't give a formula, nobody can tell, what you are doing wrong.
Usually, the formula editor and the available documentation are sufficient to work things out.

Given an input field A you could write:
Code:
`IF([A]=1;"A is 1";IF([A]=2;"A is 2";"A is not 2 nor 3"))`

3. Junior Member
Join Date
Aug 2012
Posts
4
Hi,

Please find below the code that i have put in. It also truncates the code. Is there any character limit to that.

please let me know where i have gone wrong with this.

IF(([CONDITION 1 > 0 && Condition 2 > 0 && Condition 3 > 0 && Condition 4 > 0];"A";IF([CONDITION 1 > 0 && Condition 2 > 0 && Condition 3 > 0];"B";IF([condtion 1 <= 0 && Condition 2 <= 0] && [Condition 3 > 0 && Condition 4 > 0]);"C";IF([Condition 1 <= 0 && Condition 2 > 0 && Condition 3 > 0 && Condition 4 > 0]);"D";IF([Condition 1 <= 0 && Condition 2 <= 0 && Condition 3 <= 0 && Condition 4 <=0];"E";"Fail"))

Can you please provide the correct syntax for the above query.

If the first set is implemented the output should be A,
If the second set conditions are met the output is B,
If the thrid set conditions are met the output is C,
If the fourth set conditions are met the output is D,
If the fifth set conditions are met the output is E,
finally if all the above do not meet the final output should be "Fail".

Thanks,
Vineela.

4. Senior Member
Join Date
Jun 2012
Posts
1,443
There are no logical operators, only logical functions.
OpenFormula / LibFormula is no programming language, after all.

Code:
`IF(AND([F1]>0; AND([F2]>0; AND([F3]>0; [F4]>0))); "Success"; "Failure")`

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•