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

variable formula

Status
Not open for further replies.

catchingup

Technical User
May 11, 2006
37
US
i am trying to create a formula in CR 11 that will list the number of IDcode(s). There may be 1 or more codes and I wanted them to print in a row (code1, code2, code 3, etc)

The way i have it set up right now, it is printing:
Code1
Code2
Code3

I was told that i should be able to get it to print in a row if I use a variable formula but am not certain how to go about that. The code I am pulling now is part of a larger grouping of numbers so I am using the formula:
@IDCode = {Code.Fullcode} [4 to 8]

Any suggestions?

 
Create three formulas:

//{@reset} to be placed in the group header:
whileprintingrecords;
stringvar code;
if not inrepeatedgroupheader then
code := 0;

//{@accum} to be placed in the detail section:
whileprintingrecords;
stringvar code := code + {Code.Fullcode}[4 to 8]+", ";

//{@displ} to be placed in the group footer:
whileprintingrecords;
stringvar code;
if len(code) >= 2 then
left(code,len(code)-2);

This assumes that the code is a string. If it isn't, then wrap the code field in totext(), as in:

totext({Code.Fullcode}[4 to 8],0,"")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top