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

Is it possible to report fields subsequently?

Status
Not open for further replies.

ulag

Programmer
Sep 4, 2001
23
US
I have multiple fields appearing in a single report

data is like
field1 field2 filed3 field4
... ... ... ....

I need to report like
field1
1 field2
2 field2
3 field2
... ...
field1
1 field3
2 field3
3 field3
... ....

I get the data from storedprocedure.
The only way I could do is using subreport.
But subreport run stored procedure each time
If I link the main report with subreport data the structure
I get is
field1 field2
field1 filed3
field1 field4
... ....


 
Sounds like all you need is to Group by Fields 1, place it in Group Header 1, and place Field 2 in the detail section.

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
This works for one field. If I want to add another field (ie field3) then it results like

field1 field2
field1 filed3
field1 field4
... ....
 
From your example, your data isn't designed to be reported that way.

Fields aren't tables, they exist on the same record together.

You might create a Union Query to do this, but I'm not certain as it's hard to figure out from your post.

Try posting meaningful technical information instead of text.

Crystal version
Database/connectivity used
Example data
Required output

-k
 
Crystal version 8.5 (soon will upgrade to 10)
Database/connectivity used
ODBC- stored procedure from SQL server 2000

Example data

State Source Count AuditCount VCount DCount AuditPct
Florida Agent3 1805 1063 1117 1168 38
Florida IndependentAgency 3545 1181 1168 1380 33
Florida IntegratedMktg 1568 556 6 1013 35
Florida MLFS 1400 1031 1157 1300 41
Florida PCS 101 131 166 153 68
Massachusetts Agent3 5187 501 870 1414 11
Massachusetts IndependentAgency 1130 148 435 587 11
Massachusetts Missing 1057 378 718 60 13
Massachusetts MLFS 7450 1001 1830 1304 15
Massachusetts PCS 37 1 1 4 3
NewJersey Agent3 3780 1881 3667 3881 50
NewJersey IndependentAgency 7 1 1 1 14
NewYork Agent3 4447 1008 4005 4081 45
NewYork IndependentAgency 6558 3160 6100 6061 50
NewYork IntegratedMktg 105 83 110 138 40
NewYork MLFS 4713 1101 4703 4805 47
NewYork PCS 4051 1614 3610 3557 40

Output in report

Grouped by State

Page Florida

Count
Agent3 1805
IndependentAgency 3545
IntegratedMktg 1568
MLFS 1400
PCS 101
Total sigma(count)
Source
Agent3 1063
IndependentAgency 1181
IntegratedMktg 556
MLFS 1031
PCS 131
Total sigma(count)

VCount
Agent3 1117
IndependentAgency 1168
IntegratedMktg 6
MLFS 1157
PCS 166

Page Massachusetts etc




 
I think you could do this by grouping on state and then creating subreports for each column, e.g., "count", "Auditcount", etc. You would link each subeport to the main report on {table.state}, and place each subreport in its own group header (or footer) section. Insert the summaries within each subreport by right clicking on the detail value->insert summary->sum.

-LB
 
No need for subreports for this. Just insert CrossTabs...

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thats what, I am trying to do. I use stored procedure to create data. For each sub-report CR execute stored procedure. If I link the data from main report to subreport the above prefered structure rearranges to different results.

Now my questions is
Is there any way, I can use the data from main report to sub report?
If the linking is the only way, how do I get the above prefered report?
 
Again, why can't you do this using CrossTabs in the main report?

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido,

I don't think a crosstab will work since Fields 2,3,4, etc. are in the same detail record.

ulag,

If you follow my suggestion above, you should get the correct results. Link each subreport to the main report only by state. If you still find this doesn't work, please report back and show us the results you get when you try this, so we can see what is not working.

-LB
 
Can you change the Stored Procedure? Use a Union in your SP instead.

select state, source, 'count' as type, count
from table
union
select state, source, 'auditcount', auditcount
from table
union
select state, source, 'vcount', vcount
from table

Then you can group on state, then source, then type and then display your count.

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top