beautypg.com

About this tutorial, Formula1 – HP Intelligent Management Center Standard Software Platform User Manual

Page 581

background image

About this tutorial

This tutorial uses the Xtreme.mdb sample database.

This tutorial uses Crystal syntax.

The following formula is the formula you will test for errors:

If ({customer.CUSTOMER NAME} [1 to 2 = "Bi" and
ToText({customer,CUSTOMER ID}) [1] = "6") Or
({customer.CUSTOMER NAME} [1] = 'Ro" and
ToText({customer.CUSTOMER ID}) [1] = "5")

"PREFERRED CUSTOMER"

Else

"DOES NOT FIT CRITERIA"

If correct, this formula should pick out all customers whose names begin with
"Bi" and whose customer IDs begin with "6" as well as those companies
whose names begin with "Ro" and whose customer IDs begin with "5". When
printing the field, those selections will read "PREFERRED CUSTOMER",
while the rest will read "DOES NOT FIT CRITERIA".

You will now break down the formula to check and see that each condition
of the formula is working individually.

Formula1

1.

To get started, create a report using the Customer table in Xtreme.mdb
and place the following fields from left to right in the Details section:

{customer.CUSTOMER ID}
{customer.CUSTOMER NAME}

To test each portion of the formula, you will place a new formula field next
to these two fields in the report.

2.

Create a new formula called Formula1.

3.

Type the following in the Formula text box of the Formula Editor:

If {customer.CUSTOMER NAME} [1 to 2 = "Bi" Then

"TRUE"

Else

"FALSE"

Crystal Reports 2008 SP3 User's Guide

581

22

Using Formulas

Debugging formulas