Discussion:
Basic reporting using QReport
(too old to reply)
George Trojan
2008-06-15 03:50:48 UTC
Permalink
Hi
Hope this is the correct newsgroup - if not can you direct me to one that
is.

I'm developing a POS system in C++ and would like to create some basic
reports using the QReport components (from package dclqrt60). I am accessing
my Firebird 1.5 database using the ibCore components - IB_Session,
IB_Connection, IB_Transaction and IB_Cursor (from package ibo40cdt_c5). From
what I have read my understanding is to acess the data for the report I need
to have it in a dataset for example a BDE TTable.
Could someone please give a C++ example of how I can get my data that is in
my IB_Cursor into a TTable component or another dataset component that could
be connected to the QReport.

Thanks
TerryC
2008-06-16 18:02:26 UTC
Permalink
I am accessing my Firebird 1.5 database using the ibCore
components - IB_Session, IB_Connection, IB_Transaction and
IB_Cursor (from package ibo40cdt_c5). From what I have read
my understanding is to acess the data for the report I need
to have it in a dataset for example a BDE TTable.
Any special reason you're using a TIBCursor instead of a
TIBQuery?

If you use one of those instead, it's just a matter of setting
your TQuickReport->Dataset property to the TIBQuery. Usually,
I'll create one of them specifically to feed my report.
Could someone please give a C++ example of how I can get my
data that is in my IB_Cursor into a TTable component or
another dataset component that could be connected to the
QReport.
Again, why a TIBCursor?

-Terry
George Trojan
2008-06-17 10:27:17 UTC
Permalink
Hi,

I've been using the TIBCursor to easily display my information into my
TAdvStringGrids. For the purposes of the QuickReport I can use the
TIBQuery, but I seem to be running into the same problems. If I use the
TIBQuery do I also need the TIBDataSource. I'm trying to assign the
TIBDataSource to the DataSet property in the Object Inspector but it isn't
available, even though the TIBDataSource is Enabled. Sorry I'm clearly
missing something very obvious but how do I link the TIBQuery to the
QuickReport?

Cheers
Post by TerryC
I am accessing my Firebird 1.5 database using the ibCore
components - IB_Session, IB_Connection, IB_Transaction and
IB_Cursor (from package ibo40cdt_c5). From what I have read
my understanding is to acess the data for the report I need
to have it in a dataset for example a BDE TTable.
Any special reason you're using a TIBCursor instead of a
TIBQuery?
If you use one of those instead, it's just a matter of setting
your TQuickReport->Dataset property to the TIBQuery. Usually,
I'll create one of them specifically to feed my report.
Could someone please give a C++ example of how I can get my
data that is in my IB_Cursor into a TTable component or
another dataset component that could be connected to the
QReport.
Again, why a TIBCursor?
-Terry
yannis
2008-06-17 12:54:11 UTC
Permalink
Post by George Trojan
Hi,
I've been using the TIBCursor to easily display my information into my
TAdvStringGrids. For the purposes of the QuickReport I can use the
TIBQuery, but I seem to be running into the same problems. If I use
the TIBQuery do I also need the TIBDataSource. I'm trying to assign
the TIBDataSource to the DataSet property in the Object Inspector but
it isn't available, even though the TIBDataSource is Enabled. Sorry
I'm clearly missing something very obvious but how do I link the
TIBQuery to the QuickReport?
Cheers
I have not seen or used TIBDatasource. I am confintent though that
TDatasource exists and you can use it with TIBXXXX components as well.
try to use this instead.


regards
Yannis.
TerryC
2008-06-17 13:38:29 UTC
Permalink
Well, here's the "Your First Report" topic from the QuickReport
help file. It covers the basic connections and such:

=====================================================

QuickReport is a banded report generator. Your reports are
built up of sections (bands) with text and graphics components
on them. These bands are replicated according to your data to
create the final report. A simple report might include these
components placed on a form:

* Dataset (TTable, TIBDataSet, TIBQuery, etc.)
* QuickReport component connected to the dataset
* Detail band on the report component
* Printable text (TQRDBText) on the detail band

Follow these steps to create the report:

1. Start a new project
2. Drop a TTable (or other TDataset descendant)
component on the form. Select the DBDemos alias
as DatabaseName, Customer as TableName
(substitute your database and table names here)
and set Active to True
3. Drop a TQuickRep component on the main form and set
the DataSet property to Table1 (or what ever your
DataSet component name is)
4. Expand the Bands property
5. Set HasDetail to True. This will add a detail band
to the report
6. Drop a TQRDBText component on the detail band, set
DataSet to Table1 and DataField to Company
(Again, substitute your DataSet, Query or Table
name and field name here...)

These are all the components you need to create a basic report.

To preview the report you can right click somewhere on the
TQuickRep component and select Preview from the popup menu. If
you did everything right you should now see a preview window
with your report.

So now you have a report working at design time but you want
it to work at runtime too. Follow these steps activate the
report at runtime:

1. Add a button to your main form and set the Caption
to ‘Preview’
2. Double click on the button to add a OnClick event
and add the following line of code:

QuickRep1.Preview;

3. Run your application and click the Preview button
to see the report. To print the report directly you
call the Print method instead of Preview.

You have created a simple list type report. In the following
chapters we will go through many steps in creating all types
of reports.

===================================================

That's the basic routine for hooking up a QuickReport.

-Terry
Post by George Trojan
Hi,
I've been using the TIBCursor to easily display my information into my
TAdvStringGrids. For the purposes of the QuickReport I can use the
TIBQuery, but I seem to be running into the same problems. If I use the
TIBQuery do I also need the TIBDataSource. I'm trying to assign the
TIBDataSource to the DataSet property in the Object Inspector but it isn't
available, even though the TIBDataSource is Enabled. Sorry I'm clearly
missing something very obvious but how do I link the TIBQuery to the
QuickReport?
Cheers
Post by TerryC
I am accessing my Firebird 1.5 database using the ibCore
components - IB_Session, IB_Connection, IB_Transaction and
IB_Cursor (from package ibo40cdt_c5). From what I have read
my understanding is to acess the data for the report I need
to have it in a dataset for example a BDE TTable.
Any special reason you're using a TIBCursor instead of a
TIBQuery?
If you use one of those instead, it's just a matter of setting
your TQuickReport->Dataset property to the TIBQuery. Usually,
I'll create one of them specifically to feed my report.
Could someone please give a C++ example of how I can get my
data that is in my IB_Cursor into a TTable component or
another dataset component that could be connected to the
QReport.
Again, why a TIBCursor?
-Terry
George Trojan
2008-06-18 04:21:47 UTC
Permalink
Thanks for the response. I've stepped through a similar example from the
QuickReports website but I'm using a Firebird database so I'm a little
confused as to what I'm suppose to do at your step 2. For the DatabaseName
I am only able to select BCDEMOS, dBASE Files, DefaultDD, Excel Files,
IBLocal or MS Access. Which one do I select to get access to my Firebird
Database? None seem to work? Do I need to change properties elsewhere to be
able to get access to my database?

Cheers
Post by TerryC
Well, here's the "Your First Report" topic from the QuickReport
=====================================================
QuickReport is a banded report generator. Your reports are
built up of sections (bands) with text and graphics components
on them. These bands are replicated according to your data to
create the final report. A simple report might include these
* Dataset (TTable, TIBDataSet, TIBQuery, etc.)
* QuickReport component connected to the dataset
* Detail band on the report component
* Printable text (TQRDBText) on the detail band
1. Start a new project
2. Drop a TTable (or other TDataset descendant)
component on the form. Select the DBDemos alias
as DatabaseName, Customer as TableName
(substitute your database and table names here)
and set Active to True
3. Drop a TQuickRep component on the main form and set
the DataSet property to Table1 (or what ever your
DataSet component name is)
4. Expand the Bands property
5. Set HasDetail to True. This will add a detail band
to the report
6. Drop a TQRDBText component on the detail band, set
DataSet to Table1 and DataField to Company
(Again, substitute your DataSet, Query or Table
name and field name here...)
These are all the components you need to create a basic report.
To preview the report you can right click somewhere on the
TQuickRep component and select Preview from the popup menu. If
you did everything right you should now see a preview window
with your report.
So now you have a report working at design time but you want
it to work at runtime too. Follow these steps activate the
1. Add a button to your main form and set the Caption
to 'Preview'
2. Double click on the button to add a OnClick event
QuickRep1.Preview;
3. Run your application and click the Preview button
to see the report. To print the report directly you
call the Print method instead of Preview.
You have created a simple list type report. In the following
chapters we will go through many steps in creating all types
of reports.
===================================================
That's the basic routine for hooking up a QuickReport.
-Terry
Post by George Trojan
Hi,
I've been using the TIBCursor to easily display my information into my
TAdvStringGrids. For the purposes of the QuickReport I can use the
TIBQuery, but I seem to be running into the same problems. If I use the
TIBQuery do I also need the TIBDataSource. I'm trying to assign the
TIBDataSource to the DataSet property in the Object Inspector but it isn't
available, even though the TIBDataSource is Enabled. Sorry I'm clearly
missing something very obvious but how do I link the TIBQuery to the
QuickReport?
Cheers
Post by TerryC
I am accessing my Firebird 1.5 database using the ibCore
components - IB_Session, IB_Connection, IB_Transaction and
IB_Cursor (from package ibo40cdt_c5). From what I have read
my understanding is to acess the data for the report I need
to have it in a dataset for example a BDE TTable.
Any special reason you're using a TIBCursor instead of a
TIBQuery?
If you use one of those instead, it's just a matter of setting
your TQuickReport->Dataset property to the TIBQuery. Usually,
I'll create one of them specifically to feed my report.
Could someone please give a C++ example of how I can get my
data that is in my IB_Cursor into a TTable component or
another dataset component that could be connected to the
QReport.
Again, why a TIBCursor?
-Terry
Bruce Salzman
2008-06-17 17:10:54 UTC
Permalink
Post by George Trojan
Hi
Hope this is the correct newsgroup - if not can you direct me to one that
is.
I'm developing a POS system in C++ and would like to create some basic
reports using the QReport components (from package dclqrt60). I am accessing
my Firebird 1.5 database using the ibCore components - IB_Session,
IB_Connection, IB_Transaction and IB_Cursor (from package ibo40cdt_c5). From
what I have read my understanding is to acess the data for the report I need
to have it in a dataset for example a BDE TTable.
Could someone please give a C++ example of how I can get my data that is in
my IB_Cursor into a TTable component or another dataset component that could
be connected to the QReport.
Are you using IBObjects? Because the Borland Interbase controls really aren't
Firebird compatible.
--
Bruce
Loading...