To get started, create a report using
the Customer table in the Xtreme database and place the following fields in the
Body 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.
Create a new formula called Formula1.
Select the
Formulas tab in the
Crystal Reports Designer
and type the following formula:
If {CUSTOMER.CUSTOMER_NAME} [1 to 2 = "Bi" Then
"TRUE"
Else
"FALSE"
There is an X in the margin. When you
move the pointer over the X, you will see the following error message:
The ] is missing.
Correct the formula by inserting the
missing " ] " after the 2.
When the formula is correct, the X
will no longer be displayed.
Select the
Layout tab in the
Crystal Reports Designer.
Insert the corrected formula field
adjacent to the two data fields in the Body section of your report.
Check the values in the report and
compare the fields to see if the field values returned by @Formula1 are
correct.
You will find "TRUE" listed next to
the customer names that begin with "Bi" and "FALSE" next to all the others.
Now you will check the other portions of
the formula. Create Formula2, Formula3, and Formula4, using the formulas
specified for each.
Insert each formula field on the same line
of the Body section for easy comparison. Check each one for errors, fix as
needed, and make sure the values returned are correct before moving on to the
next formula.