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

Dynamic Columns with CR(9) & Delphi 7

Status
Not open for further replies.

shanewiso

Programmer
Jul 20, 2005
5
AU
We are currently trying to make the decision to use either CR9 or Quick Reports, we develop applications with Delphi7.

Anyway, the question I have is, Can CR9 handle Dynamic Columns at Runtime? For Example we have a query that can change the amount of columns in a result set based on the Users Selection.

Can anyone assist ?
 
I'm trying to truly understand what you are asking. Are you asking if the number and data types of columns can be dynamically altered? Simple example would be a report where one user runs it and the report contains:

Name Age Birthday Phone

Another user runs the same report and returns:

Name Gender Address Age Work_Address




 
Hello!
Business Objects website gives instructions on how to do this at
So, it seems that it can be done...
Hope this helps!
B~

Boni J. Rychener
Hammerman Associates, Inc.
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
800-783-2269
 
The article for which BoniR provided a link decribes a means to suppress columns in a report. However it assumes that the columns in the report are static and that you simply want to only display a subset of the whole but always in a specific order/structure. If that's what you want to do it works fine. Following is example of what it would produce for output:

eg: name age gender address state zip phone e-mail

or

name age gender address state zip

or

name age gender


However, it does not allow for the structure to be altered or the elimination of white space if you wanted everything but address. The report would look something like the following:

eg: name age gender state zip phone e-mail

 
I responded to your other post on this topic, referring to a method I outlined in thread149-655589. Although the thread subject refers to suppression, the method uses parameter selections to determine column content.

-LB
 
I read through thread149-655589 and some very intersting ideas are provided. It confirmed what our staff had concluded a while back... very complicated to get there from here with Crystal. The sad thing is that this was easy to do 10 years ago using Crystal with a VB3 front end. You could include a TRUEGRID control on the Window that was bound to Crystal Reports. The Crystal Report produced was totally dynamic since the grid could be filled with data from any SQL query. We still have applications in production that use this feature for basic ad-hoc reporting.

I don't know if this method is still a possibility or not.
 
Thanks, for the replies, instead of using supression or parameters through to crytal, can we do the following ?

The Dataset that the report is based on contains a Group By,

Each record of the dataset represents a column in the report.

We can limit the number of records returned by the query, so we will not run out of “realestate”.

In quick reports we can do the following;

iColWidth is a variable that is calculated at runtime based on the number of records returned and the orientation of the page

for i := 1 to qry.Fields.Count do
begin
with TQRDBText.Create(nil) do
begin
Autosize := False;
Parent := DetailBand1;
Left := iLeft+5;
Width := iColWidth-10;
Top := 2;
DataSet := qry;
DataField := qry.Fields.fieldbyNumber(i).FieldName;
end;
iLeft := iLeft + 10 + iColWidth;
end;

Can we achieve the same result in Delphi & Crystal Reports at Runtime as shown above, It seems unnecessarily complex to create a pre-defined number of columns then suppress them.
 
I'm sorry shanewiso but I am going to go out on a limb here and say that out of the box Crystal Reports cannot really do what you are asking. By out of the box I mean Crystal Reports without the aid of other development software such as C#, VB.net, ect.

I know of NO WAY to control the contents, size, data type, or location of a field on the report dynamically using only Crystal Reports. However it is my understanding that the Crystal architecture does provide a SDK that probably would allow you to create a program that dynamically writes a Crystal Report.

From what I have seen, Crystal Reports thinks in terms of the data that is made available to it when you are designing a report. It doesn't know what might be the result set from it query, it only knows what has been returned. From my experiance Crystal Reports does not like stored procedures or queries that provide the ability to return multiple data structures or multiple data sets. It simply doesn't know which structure or data to make available to you to design the report.

I hope that all helps and I wish you luck.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top