Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Quick Report And DBGrid MultiSelect

67 views
Skip to first unread message

forums.inprise.com

unread,
Jan 11, 1999, 3:00:00 AM1/11/99
to
Is there any way to print only the selected DBGRID ROWS on
the report ?

eg. i selected 1st and 4th and 5th row (DBGrid MultiSelection = True)
on my DBGrid and i want to show these lines on my report instead
the whole dbgrid(or datasource).

Thanx

n4...@ix.netcom.com

unread,
Jan 12, 1999, 3:00:00 AM1/12/99
to

Create an empty copy of the dataset, batchcopy the selected rows to
the new dataset and then assign the dataset to the report's dataset
property.

regards
A.G.

Tobias Mueller

unread,
Jan 12, 1999, 3:00:00 AM1/12/99
to
Hi,

you have to use filters with your DataSource1.Database (DataSource1 is the
source which the Grid is linked to) or directly with the Table/Query
component.

- Tobias (tobias...@swol.de)


forums.inprise.com <gat...@hotmail.com> wrote in message
news:77dn45$o9...@forums.borland.com...

forums.inprise.com

unread,
Jan 12, 1999, 3:00:00 AM1/12/99
to

>source which the Grid is linked to) or directly with the Table/Query
>component.
>
>- Tobias (tobias...@swol.de)
>
>
>forums.inprise.com <gat...@hotmail.com> wrote in message
>news:77dn45$o9...@forums.borland.com...
>> Is there any way to print only the selected DBGRID ROWS on
>> the report ?
>>
>> eg. i selected 1st and 4th and 5th row (DBGrid MultiSelection = True)
>> on my DBGrid and i want to show these lines on my report instead
>> the whole dbgrid(or datasource).
>>
>> Thanx
>>


do you want to try to filter 100.000 records ? =)
it takes about half hour to filter the 100.000 records ...


Tobias Mueller

unread,
Jan 13, 1999, 3:00:00 AM1/13/99
to
Can't believe it. I do filter approx. 150.000 records in about 3 seconds.
BTW: I don't think there's any other way. Perhaps you could look through the
soruce code of the DBGrid for some internal storing, but I don'T beleive
you'll find anything.

- Tobias (tobias...@swol.de)

David Martin

unread,
Jan 13, 1999, 3:00:00 AM1/13/99
to
Hi,

Put the DataSet property of your Report to nothing. This make the report to
ask you for data at the OnNeedData Event.

Place there code to jump on the table using the SelectedRows property of the
grid (A list of bookmarks) and stop the report.

HTH

forums.inprise.com escribió en mensaje <77dn45$o9...@forums.borland.com>...

forums.inprise.com

unread,
Jan 14, 1999, 3:00:00 AM1/14/99
to

>grid (A list of bookmarks) and stop the report.
>
>HTH
>
>forums.inprise.com escribió en mensaje <77dn45$o9...@forums.borland.com>...
>>Is there any way to print only the selected DBGRID ROWS on
>>the report ?
>>
>>eg. i selected 1st and 4th and 5th row (DBGrid MultiSelection = True)
>>on my DBGrid and i want to show these lines on my report instead
>>the whole dbgrid(or datasource).
>>
>>Thanx
>>
>>
>
>

do you have any idea how to implement the OnNeedData Event
in code ? eg to place the selected Rows of DBGrid to report ?
i need the code if you can post it .. thanx =)


forums.inprise.com

unread,
Jan 14, 1999, 3:00:00 AM1/14/99
to
>Can't believe it. I do filter approx. 150.000 records in about 3 seconds.


150.000 records in 3 seconds ? can you show me how to do this ?
thanx

(i'm using paradox 7 and i use setrange to do the work. it's too much
faster thanx Filter)

David Martin

unread,
Jan 14, 1999, 3:00:00 AM1/14/99
to
Of course, here it is ...

Add this lines to your code ...

...
private
{ Private declarations }
FCont: integer;

...

procedure TForm1.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
FCont := 0;
end;

procedure TForm1.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
begin
MoreData := (FCont < DBGrid1.SelectedRows.Count);

if MoreData then
begin
Table1.Bookmark := DBGrid1.SelectedRows[FCont];
Inc(FCont);
end;//if
end;

forums.inprise.com escribió en mensaje <77j7a5$sl...@forums.borland.com>...

Babis Michail

unread,
Jan 14, 1999, 3:00:00 AM1/14/99
to


well it doesn't work .. it's show me an error message
"Record/Key Deleted". =(

i would really apriciate if you can send me a example project .. =)

my e-mail gat...@hotmail.com

if you can't send me that ok.. thanx again for all your answers.


David Martin

unread,
Jan 15, 1999, 3:00:00 AM1/15/99
to
I Think you don't use the same table to move by SelectedRows and to link lo
DBGrib.

I send you the project...


Babis Michail escribió en mensaje <77lpoh$1h...@forums.borland.com>...

0 new messages