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!

How to deal with subreport problem in a group header?

Status
Not open for further replies.

rajrev

Programmer
Sep 25, 2003
148
US
Hi,
Here is the problem:
Output at the time of using the the fields directly in the detail section was:
Empname Empid state .... more fields
zzzz 111 CA
AZ
IL
AB
yyyy 2222 IL
CA
NY
....
like this.

but the user wants to make the state display in one row.

Output need:
Empname empid state ..... more fields
zzz 111 CA, AZ, IL, AB
yyy 222 IL,CA,NY
...
like this.

Note :We are using 10 parameters and state is the one of the parameters. (all are Multiple selection)
Any solution for this problem or need more info. please let me know.

Thanks in adv. for replies.
Thanks,
MK
 
You didn't explain how the subreport fits into your issue.

You can accumulate the state names by creating three formulas:

{@reset} to be placed in the group header:
whileprintingrecords;
stringvar states := "";

{@accumstates} to be placed in the detail section:
whileprintingrecords;
stringvar states;

if instr(states,{table.state}) = 0 then
states := states + {table.state} + ", ";

{@displaystates} to be placed in the group footer:
whileprintingrecords;
stringvar states;
left(states,len(states)-2);

Then drag the group header fields to the group footer and suppress the group header and details sections.

If you need this in the group header, then you would do the above in a subreport.

-LB
 
Hi LB,
thanks for your replay. I applied these 3 formula's in my main report. It says an error "string length is lessthen 0 or not an intger". (pointing in the formula placed in group footer. (left(states...))
We don't have the states for all emp. ie some of them are blank.
need more info. please let me know.
Thanks
MK
 
Hi,
I found the solution for the problem. Please ignore the previous post.
I used an if condition
if(length(states)>2) then
states :=left(....)
its working.
MK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top