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

One field....multiple values.....one line.......

Status
Not open for further replies.

AuctionLamb

Programmer
Feb 16, 2005
65
ZA
Hi guys!!

Have a bit of an issue here. I have a field called QuotePrice on my report. Some of my records has let's say 4 different quote prices but I want to display it in one line, how do I do that? For example:

I get this:

QUOTEPRICE
1000
2350
210
6540

But want to let it look like this:

QUOTEPRICE1 QUOTEPRICE2 QUOTEPRICE3 QUOTEPRICE4
1000 2350 210 6540
 
Are these detail sections? That must mean several different records in the Crystal table, even if you regard them as a single record.

If the four items were distinct field from a single record, you could just move them.

Assuming it is different records, you shuold be able to adapt this code, which I used for accumulating postcodes for grouped customers:
Code:
Accumulate postcodes for groups
// Accumulate using a formula field (suppressed) in the detail line.  Allow for nulls and blanks.
whileprintingrecords;
if not isnull({Recc.Postcode}) and {Recc.Postcode} <> " "
then stringvar pst := pst + {Recc.Postcode} +", "
else if length(pst) = 0 
then stringvar pst := pst + "Excluding blanks; "
else stringvar pst := pst 

// Show in using a formula field in the group footer.
whileprintingrecords;
stringvar pst;
left(pst,len(pst)-2)

//  Clear using a formula field using in the group header.
whileprintingrecords;
stringvar pst := "";

Note that clearing in the footer avoids problems with group headers repeating on a new page, which does clear everything for the group.  Provided the 'clear' is placed in the section AFTER the display, it will do them in that order.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
You seem to be making something like the Join function, where AuctionLamb appears to be implying that s/he wants the values to appear in exclusive fields, as they would if they were vertical.

You could very simply achieve this with the UBound or Split function.
Group Header - (if you need it)
Code:
WhilePrintingRecords;
StringVar Array AddVar := "";
Details Section
Code:
WhilePrintingRecords;
StringVar Array AddVar;

AddVar := AddVar + {PostCode};""
Group Footer Section
Code:
WhilePrintingRecords;
StringVar Array AddVar;

If UBound(AddVar) > 0
Then AddVar[1]
Else ""
Duplicate the last formula for each instance you think you'll need across the page, incrementing each of the numbers in the formula by 1.

Naith
 
Do you have a field that is unique to each instance of the quoteprice, e.g., a date field or a quote#? If so, you could insert a crosstab in the report header or footer and add that field as the column field, and use the quoteprice as the summary field.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top