Solved

TDBGrid and Multiselect with Quickreport

Posted on 1997-03-13
5
400 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help on project with Soap 10 61
tidtcpserver connection lost handle 2 109
Delphi: ForceDirectory plain function 7 48
Broadcast a message using ICS 2 20
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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