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

Presentation of rows 1

Status
Not open for further replies.

StineV

Technical User
Apr 27, 2006
12
NO
Hi,

I have a subreport which shows the invoiceno. related to a purchase order in the main report. Everything works fine, except I want the data in the subreport to be printed like this 1223, 234, 546, instead of
1223
234
546

I have tried the formulas suggested here :
but that didn't work for me.

The subreport is placed in one of my pageheaders.

Techical info : Sybase 5.5 and CR 9.2.0448
 
What you need is something that collects the codes and strings them together at the end. I did something similar for 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 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.

You may have to use ToText to convert the codes to 'string', if they are numbers.

PS, what you have is Crystal 9, the rest of the code isn't necessary

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanks Madawc! It finally works! Can't figure out why I didn't get the code suggested in the link above to work - it says essentialy the same as your. Oh well...it works fine now :)

Any tips to how I can remove the comma after the last record ?

S
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top