Solved

TDBGrid and Multiselect with Quickreport

Posted on 1997-03-13
5
393 Views
Last Modified: 2013-11-22
I have a TDBGrid with some data fields in it. Then I set the multiselect option to true in order to be able to choose several fields in the grid. And now, I want to tell QuickReport that he has to print a report I've previously created taking the data from the fields i have selected in the grid. How can I do that?
For Example: I have a grid with customers and I select 3 customers and I want my report (that prints the personal information of a customer) to print the information of only those 3 customers I have selected.
0
Comment
Question by:sime
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:javiertb
Comment Utility
You should copy those selected records to another table attached to a datasource so you can switch quickreport to connect this datasource to print them.
Hope this helps.
0
 

Author Comment

by:sime
Comment Utility
But, how can I know which records I have selected in the grid ?
0
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
Comment Utility
You can browse the rows checking for selected ones with:

   if DBGrid.SelectedRows.CurrentRowSelected then
        // Some code here. i.e.:copy to your temp. table

0
 

Author Comment

by:sime
Comment Utility
Hi, I have tried what you told me and it haven't resolved my problem yet. Please write me down what I have to write (source code) to copy one by one the records I have selected in the DBGrid, because with CurrentRowSelected I only get then Current Record and I want them all (I can't find any help about this feature). Thanks very much.
0
 
LVL 2

Expert Comment

by:javiertb
Comment Utility
- Suppose you have 3 selected records.

 Table.Open;
 Table.First;
 while (not Table.EOF) do
 begin
    if DBGrid.SelectedRows.CurrentRowSelected then
      // copy to your temp table
      // i.e.: TableTemp.Append;
      //       TableTempField1.Value:=Table1Field1.Value;
      //       TableTemp.Post;  
    Table.Next;
 end

You can also use bookmarks to avoid losing previous database pointer.


0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now