Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Blank field causes Array error Post Reply Post New Topic
Author Message
Jakecola
Newbie
Newbie
Avatar

Joined: 05 May 2012
Location: United States
Online Status: Offline
Posts: 6
Quote Jakecola Replybullet Topic: Blank field causes Array error
    Posted: 07 May 2012 at 12:48am
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. I'm using CR Ver. 11.5

Edited by Jakecola - 07 May 2012 at 12:49am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 07 May 2012 at 3:46am
already answered in the other posting
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.