Crystal Reports - If Then Else


Advertisements

The if-then-Else statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular condition meets true.

If you see the following If-Then-Else statement with Boolean operators, it has allowed you to pass multiple conditions in the formula and returning the value, if the condition is true.

If({PROJECT.Customer\Customer Name} [1 to 2] = "An" and
ToText({PROJECT.Time\Year}) [1] = "2") or
({Project.Customer\CUSTOMER NAME} [1 to 2] = "Ja" and
ToText({PROJECT.Time\Year}) [1] = "2") Then
"Five star rating CUSTOMER"
Else
"1 star rating CUSTOMER"

This statement says that when any of the condition is true (before and after OR operator), then it will print Five star rating customer otherwise it will print 1 star rating customer.

This formula has been saved and then added to the body of the report under the structure tab as shown in the following images −

Structure Tab

Structure Tab1

A new column in the report has been added with the rating of the customers as mentioned in the TEST formula.

Useful Video Courses


Video

Crystal Reports Online Training

37 Lectures 2 hours

Neha Gupta

Video

Crystal Healing: The Complete Certified Practitioners Course

61 Lectures 4.5 hours

Sasha Miller

Video

Certificate in Crystal Healing for Kundalini & Chakra

31 Lectures 32 mins

Prof Krishna N Sharma

Video

Certification in Crystal Healing - Accredited Masterclass

35 Lectures 2 hours

Prof Krishna N Sharma

Video

Certification in Crystal Reiki - Master / Teacher Training

24 Lectures 2 hours

Prof Krishna N Sharma

Advertisements