Search code examples
mysqlpentahopentaho-design-studio

How to Use Multiple Condition in Open Formula in Pentaho Report Designer?


For single condition it is correct but if there is multiple condition hard to customize in open formula. For example i want grading like A,B,C .I did such but doesn't work?

Code tried:

=IF([total]>90;"A";0 IF(OR([total]<80 ; [total]<=90);"B";0; IF(OR([total]<60 ; [total]<=70);"C";0; )))

Solution

  • Try the below in the open formula section:

    =IF([total]>90;"A";IF(OR([total]<80 ; [total]<=90);"B";"C"))
    

    Since there is a nested looping condition you would need to place the inner condition inside the ELSE part of the Outer Condition.

    Also i assume you need to display the grade against the marks scored by a student. So You can take a "Label" into the details section of the report. Open the Attribute section of the label and inside the value part, use the above formula. Check the image below:(highlighted) enter image description here

    Hope it helps :)