Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warning: Cascading Errors

Status
Not open for further replies.

DanCCC

Technical User
Aug 9, 2002
25
0
0
US
I'm producing a report listing donors alphabetically, with their name and address in the group header, and the Detail listing their contributions by date under their name.

I started by creating a simple formula putting their First and Last names together, last name first, so they'd sort alphabetically - it looked like this:

{table.LastName}+", "+{table.FirstName}

Then I created a Group using that formula.

Unfortunately, some of these donors are companies and don't have a first name. And a formula as I created above, as you veteran programmers know, returns a big fat BLANK if any field is blank (I have since worked my way around that problem, although there's probably a more elegant solution than mine, which entailed dropping the fields into a text box).

So when the report prints out, the name of the first group is blank, but the address is there. And there's lots of data there. But ALL the people and companies who lacked a First Name field, got lumped in there.

So I created a report crediting a whole bunch of people's donations to the wrong account, simply because some of them had a blank First Name field.

Now you know. Don't do what I just did.

Later,

Dan
 
IF IsNull({table.LastName}) THEN
{table.Company_Name}
ELSE
{table.LastName}+", "+{table.FirstName}

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Dear DanCCC;

We have all been bit by this in the past.

Ido's solution will work for you. Here is one that I commonly use which handles formatting.

You might be able to incorporate it with Ido's, however from reading your post, it seems that you are placing the Company Name in the Last Name field? Is that right?

//@formula

stringvar F := If IsNull({Clients.First Name}) then "" else {Clients.First Name};

stringvar L := If IsNull({Clients.Last Name}) then "" else {Clients.Last Name};

stringvar c := If (IsNull({Clients.First Name}) or IsNull({Clients.Last Name}) )then "" else if ({Clients.First Name} = "" or {Clients.Last Name} = "") then "" else ", ";

L + c + F
//end formula

Maybe not the most elegant either, but I hope that helps you,

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top