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

A list of Details into one line 1

Status
Not open for further replies.

neskin

Programmer
Mar 13, 2002
104
AU
Hi,
I get fields from db
datetime tailnumber
2/07/2008 7:02PM N555
2/07/2008 7:02AM N333
2/07/2008 6:02AM N222
I need to create report as a letter where in text those 2 fields will be display as one line

...on 2/07/2008 at 7:02PM,2/07/2008 at 7:02AM and 2/07/2008 at 6:02AM your helicopter N555,N333 and N222 were respectively so on text

I am using Crystal XI

Thank you in advance
 
You can collect details from a group and show them all in the group footer. Try adapting something I wrote to collect postcodes:
Code:
// 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
Code:
// Show in using a formula field in the group footer.
whileprintingrecords;
stringvar pst;
left(pst,len(pst)-2)
Code:
//  Clear using a formula field 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.

Since you want multiple values, it will be more complex, but should work OK.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Try this:

//{@accum} for the details section:
whileprintingrecords;
stringvar dtx;
stringvar tailno;

dtx := dtx + totext(date({table.datetime}),"MM/dd/yyyy")+" at "+
totext(time({table.datetime}),"hh:mm") + ", ";
tailno := tailno + {table.tailnumber}+", ";

In the report footer, use:

//{@display}:
whileprintingrecords;
stringvar dtx;
stringvar tailno;
stringvar array dty := split(dtx,", ");
stringvar array tny := split(tailno,", ");
numbervar i;
numbervar j := ubound(dty);
stringvar y;
stringvar z;
redim preserve dty[j];
redim preserve tny[j];

for i := 1 to j-2 do(
y := y + dty+", ";
z := z + tny+", "
);

"On " + y + " and " +dty[j-1] + ", your helicopters " +
z + " and " + tny[j-1];

If you want these results at a group number, place {@display} in the group footer, and add a reset formula in the group header:

whileprintingrecords;
stringvar dtx := "";
stringvar tailno := "";

-LB
 
thank you LB.It works perfect!!!!!!!!! .Only one little thing - the comma should not be before "and"

 
I disagree on the punctuation, but if you insist, try this:

"On " + left(y,len(y)-2) + " and " +dty[j-1] + ", your helicopters " +
left(z,len(z)-2) + " and " + tny[j-1];

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top