I have a problem that maybe someone can offer their
expertise toward solving for me. I’m
fairly new to Crystal Reports and need to print the name of two employees at
the bottom of a survey form. The reason for the breakdown is I don’t want
to print the employees’ full name. Just the initials so they can be
identified only by the staff and not the person receiving the survey
form to complete. It's a privacy thing. Here is what I’ve done so far to reach a solution and the problem facing me. The two employee
names ‘employee1’ and ‘employee2’ are each in a separate field as follows:
‘employee1’ (Last, First); ‘employee2’ (Last, First)
In formulas, I broke down the fields as follows to reach the
result at the bottom of the page for employee1.
DRV FNAME: stringvar firstname
:=split({Forms_Standard_Drivers.DriverName},",")[2]
DRV LNAME: stringvar lastname
:=split({Forms_Standard_Drivers.DriverName},",")[1];
DRV_INIT: LEFT ({@DRV LNAME}, 3)
DRVF_INIT: LEFT ({@DRV FNAME},
2)
Final fields at bottom of report for
employee 1
DRV_INIT DRVF_INIT
I did the same thing for the second employee, ie:
ATT FNAME: stringvar firstname
:=split({Forms_Standard_Drivers.AttendantName},",")[2] (etc., etc.)
The solution
worked fine until there was no name returned in one or the other fields. This kicked out an array error and printing
would not complete.
My question
is this: Can this formula be condensed
into one instance and allow for the skipping over the field if it is blank and
enter a 0 (zero), n/a or something to avoid the array error? Currently, each of
the DRV.. and ATT.. formulas are individual ones. I’m guessing there is a much more efficient
way of achieving this objective and would really, really appreciate your expert guidance. Thank you.
Edited by Jakecola - 05 May 2012 at 11:07am