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!

dynamically adding report fields to a CR 8.5 report

Status
Not open for further replies.

ktrang

Programmer
May 24, 2002
8
CA
I'm trying to create a vb app which dynamically creates a report. The user is able to select desired fields from a database at runtime to add to a report. Is there anyway to adding fields at runtime to a report? Or any othe way to accomplish this goal?

Many Thanks.
 
You can add fields in VB code - you'll need the Developer version of Crystal and you'll need to buy some Report Creation API licenses if you use it beyond the dev environment.
Alternatively, you could prompt the user for which fields they want and use a formula to display the required formula
For example:
if {?choice} = 1 then {Report.Region} else
if {?choice} = 2 then {Report.ZIP} else
if {?choice} = 3 then {Report.Area}

This is cumbersome and inflexible but it may be enough.

Or, you could base the report on a view, stored procedure or temp table and update the view etc before the report runs.
I'm sure someone else will be along with even more options! Andrew Baines
Chase International
 
To build upon Andrew's idea of "you could prompt the user for which fields" (not my favorite choice, but it requires less resource$):

You can place a varied quantity of fields in numerous sections of each type in the report, prompt for what they want (or pass along the parms), then display/suppress selectively based on the number of fields they passed.

i.e.,

DBA: <F1> <F2> <F3> <F4> <F5>
DBB: <F1> <F2> <F3> <F4>
...

DBA/B = the detail bands (you can pass along groupings too)

<Fx> = Field X (these are formulas which are populated from the fields passed)

If they choose 5 fields, suppress DBB, if 4, suppress DBA, etc...

This requires hard coding the <F1> thru <F5> formulas in the report, but it looks like it's a low feature customizable report, sorta, kinda...

Right, the RDC is better, but this is a workable solution.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top