Solved

TDBGrid and Multiselect with Quickreport

Posted on 1997-03-13
5
396 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
ID: 1334749
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
ID: 1334750
But, how can I know which records I have selected in the grid ?
0
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
ID: 1334751
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
ID: 1334752
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
ID: 1334753
- 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

774 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