INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Crystal Report Array from Database Field

Crystal Report Array from Database Field

(OP)
I am building a report from a donation database that needs to include various benefit detail for each gift. I need to create a sentence from several multi-valued database fields that exist for the benefits. In the database, there could be multiple benefits for each gift-- each benefit would subsequently have its own quantity and value.

I need to get this into sentence format: Quantity1 + Benefit1 + Value1, Quantity2 + Benefit2 + Value2, etc.
Something like "2 Round(s) of Golf valued at $200.00, 2 Dinner(s) at Club valued at $100.00."


Each one of these fields could be multivalued, single valued, or null. Below is what the data fields look like in Crystal.

RE: Crystal Report Array from Database Field

What problems are you running into? If you put the fields from this table in the detail section, how do they display? Can you provide a sample?

Try writing a formula like the following for the detail section:

//{@accum}:
whileprintingrecords;
stringvar x;
if not isnull({table.benefit}) then
x := x + totext({table.count},0,"")+" "+{table.benefit}+" Valued at $"+totext({table.value},2)+", ";

Insert a group on the donor field, and then add a reset formula to the group header:

whileprintingrecords;
stringvar x := "";

In the group footer, add a display formula for the final results for that donor:

whileprintingrecords;
stringvar x;
if len(x)>=2 then
left(x,len(x)-2)

Not sure how your value field displays, so maybe you can remove the dollar sign in the formula.

-LB

RE: Crystal Report Array from Database Field

(OP)
You are a life saver. This is exactly what I needed.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close