Discussion:
TQRSubDetail on quick report
(too old to reply)
Sonnich Jensen
2004-09-02 15:09:36 UTC
Permalink
Hi all!

I have a report, based on 2 queries (linked by a TDataSource).
The is a TQRBand (rtDetail), which shows rows from the 1st query, then
I have a TQRSubDetail band, to show related data from the 2nd query.

But I want it so, that the first row, in the 2nd table, is shown on
the detail band, not on the TQRSubDetail band. The TQRSubDetail band
should start with the 2nd row - any idea how to do this?
I have played around with it for some time now.

The wanted result:

a b c d e
f
g
where a b c d is from the 1st table, and e f g is from the 2nd table.

Any ideas?

S
Bjørge Sæther
2004-09-02 21:20:55 UTC
Permalink
Post by Sonnich Jensen
Hi all!
I have a report, based on 2 queries (linked by a TDataSource).
The is a TQRBand (rtDetail), which shows rows from the 1st query, then
I have a TQRSubDetail band, to show related data from the 2nd query.
But I want it so, that the first row, in the 2nd table, is shown on
the detail band, not on the TQRSubDetail band. The TQRSubDetail band
should start with the 2nd row - any idea how to do this?
I have played around with it for some time now.
a b c d e
f
g
where a b c d is from the 1st table, and e f g is from the 2nd table.
Any ideas?
You may create corresponding "e"/"f"/"g" calculated fields in the master
set, and retrieve values from the details set in the OnCalc event - or
simply join the two tables in SQL. That is - If you have an easy way to
select only this first record. Then the subdetails' SQL should leave out the
first record.
--
Regards,

Bjørge Sæther
***@haha_itte.no
-------------------------------------
I'll not spend any money on American Software products
until armed forces are out of Iraq.
Sonnich Jensen
2004-09-03 06:19:30 UTC
Permalink
Post by Bjørge Sæther
Post by Sonnich Jensen
Hi all!
I have a report, based on 2 queries (linked by a TDataSource).
The is a TQRBand (rtDetail), which shows rows from the 1st query, then
I have a TQRSubDetail band, to show related data from the 2nd query.
But I want it so, that the first row, in the 2nd table, is shown on
the detail band, not on the TQRSubDetail band. The TQRSubDetail band
should start with the 2nd row - any idea how to do this?
I have played around with it for some time now.
a b c d e
f
g
where a b c d is from the 1st table, and e f g is from the 2nd table.
Any ideas?
You may create corresponding "e"/"f"/"g" calculated fields in the master
set, and retrieve values from the details set in the OnCalc event - or
simply join the two tables in SQL. That is - If you have an easy way to
select only this first record. Then the subdetails' SQL should leave out the
first record.
This is not a good solution for what I need. But writing about ones
problems is a good idea, and sleeping on it too...

{ I got the idea, that this could be a way to skip the first row in a
dataset... and this works ! }
procedure TfrmPrintform3.QRSubDetail1BeforePrint(Sender:
TQRCustomBand;
var PrintBand: Boolean);
begin
QRSubDetail1.DataSet.Next;
end;

{ next, the problem is, that it does not show me the first row on the
2nd and following DetailBand, but only on the first (I have the first
line there, the following are SubDetailbands) - so "forcing" the
datasat could be a way.
This works.
Enjoy anyone, if this might help you.
procedure TfrmPrintform3.qrbDetailBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
QRSubDetail1.DataSet.First;
end;

BR
Sonnich
Sonnich Jensen
2004-09-03 12:54:29 UTC
Permalink
Post by Sonnich Jensen
Post by Bjørge Sæther
Post by Sonnich Jensen
Hi all!
I have a report, based on 2 queries (linked by a TDataSource).
The is a TQRBand (rtDetail), which shows rows from the 1st query, then
I have a TQRSubDetail band, to show related data from the 2nd query.
But I want it so, that the first row, in the 2nd table, is shown on
the detail band, not on the TQRSubDetail band. The TQRSubDetail band
should start with the 2nd row - any idea how to do this?
I have played around with it for some time now.
a b c d e
f
g
where a b c d is from the 1st table, and e f g is from the 2nd table.
Any ideas?
You may create corresponding "e"/"f"/"g" calculated fields in the master
set, and retrieve values from the details set in the OnCalc event - or
simply join the two tables in SQL. That is - If you have an easy way to
select only this first record. Then the subdetails' SQL should leave out the
first record.
This is not a good solution for what I need. But writing about ones
problems is a good idea, and sleeping on it too...
{ I got the idea, that this could be a way to skip the first row in a
dataset... and this works ! }
TQRCustomBand;
var PrintBand: Boolean);
begin
QRSubDetail1.DataSet.Next;
end;
{ next, the problem is, that it does not show me the first row on the
2nd and following DetailBand, but only on the first (I have the first
line there, the following are SubDetailbands) - so "forcing" the
datasat could be a way.
This works.
Enjoy anyone, if this might help you.
procedure TfrmPrintform3.qrbDetailBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
QRSubDetail1.DataSet.First;
end;
BR
Sonnich
Sorry, it needed a little more:

{ this forces the first row to be present at all times on the
DetailBand }
procedure TfrmPrintform1.qrbDetailBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
if qrbSubDetail.DataSet <> nil then
qrbSubDetail.DataSet.First;
end;

{ this skips the first row (which is on the DetailBand) and starts
with the
2nd row on the SubDetailBand }
procedure TfrmPrintform1.qrbSubDetailBeforePrint(Sender:
TQRCustomBand;
var PrintBand: Boolean);
begin
{ skip only first row! }
if qrbSubDetail.DataSet.RecNo = 1 then
qrbSubDetail.DataSet.Next;
{ if we have one row only, then we MUST NOT PRINT! }
PrintBand := (qrbSubDetail.DataSet.RecordCount <> 1);
end;

AND NOTE:
Do not use DisableControls for the DetailBand's query! That will stop
the SubDetailBand too!!!!

Loading...