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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report Array from Database Field 1

Status
Not open for further replies.

lm1340

Technical User
Apr 27, 2015
28
US
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.

EOY_Benefits_bdttvr.png
 
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
 
You are a life saver. This is exactly what I needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top