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

Listing field data on the same line rather than in each section 1

Status
Not open for further replies.

DJWheezyWeez

Technical User
Jun 5, 2008
265
US
I'm using CR XI.

The way my report is setup, I have a lot of fields but the important ones are Job Number and Machine. I have a subreport that brings in ItemCode. In the system, a Job Number has more than one ItemCode and more than one Machine but Machine and ItemCode aren't related. Before I added the subreport, I had the Job Number as my GH1 and then the Machine repeated for each ItemCode.

My question is is there a way to have the ItemCode display on one line? I tried using join({table.ItemCode},", ") since I have normally used that for Page/Report headers but that didn't work. I'm looking for some way to do the same thing as join but in the GH section.

It's going to look something like:
GH1 | Job: 201000 ItemCodes: 10021, 12021, 14410, 12233
Det | {Machine}

I hope that makes sense. Any help is appreciated.

-DJWW

 
Insert the sub in the group header and link it on job number. Then in the sub, create formulas like this:

//{@accum to be placed in the detail section:
whileprintingrecords;
stringvar x := x + {table.itemcode}+", ";

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

Suppress all sections within the sub except the report header.

-LB
 
Thanks LB. I did exactly what you said and though I had some issues, I made some changes and got it to work.

Your method showed one line but it never reset. For the second Job Number, it included the Items from the first and added on the ones from the second. I just split the RF into RFa and RFb threw in a reset into RFb. The other issue was if there was only one Item on the Job, it displayed twice. For that I changed your second formula to read:

whileprintingrecords;
shared stringvar x;
if distinctcount({table.itemcode}, {table.jobcode}) = 1
then {table.itemcode}
else if len(x) > 2
then left(x,len(x)-2)

That way it will display the single Item if there is only one per Job.

Thank you very much for the help.

-DJWW

 
I would place the reset in the subreport report header. For the accum formula, change it to:

//{@accum to be placed in the detail section:
whileprintingrecords;
stringvar x;
if not({table.itemcode} in x) then
x := x + {table.itemcode}+", ";

This will give you distinct codes. Then use my original display formula.

-LB
 
I've come up with a new related issue. It seems that the Item is listed more than once for some Jobs and when it's listed, it lists it multiple times. So my line might look like:
ItemCodes: 10021, 12021, 12021, 12021, 14410, 12233

How can I get it to show each Item once?
 
That shouldn't happen with these formulas. Please show the formulas you are currently using.

-LB
 
I'm sorry, I didn't use your previous formula. To my knowledge, the report was working before you posted that so I ignored it since I didn't think I needed it. I used that formula and it worked. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top