Solved

Report Builder

Posted on 2004-08-09
7
1,102 Views
Last Modified: 2010-04-16
hello,
example:-
before display a report, a user may want to use some of the report filters like Sort by, Date, etc...

my question:-
if the user wants to sort the records according to the customer_id, how can i display a sentence "Sort By : Customer ID" in the report? or if the user wants to sort by customer_name the report also should display a sentence "Sort By : Customer Name"

I tried the "Variable" component in the report builder, but i failed the make it, may be i don't really know how to use that component....can any experts give me some guideline?

Thanks
josh
0
Comment
Question by:joshfly
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:Darth_helge
ID: 11760066
If you read the manual, you find out that you can add the rbprvDlg unit into your project. This unit contains the Report Preview window which you can manipulate. Then you can just add some buttons on the top panel on the form which manipulates your SQL Queries. Did you understand?
0
 
LVL 5

Expert Comment

by:Darth_helge
ID: 11760107
mine is located at C:\Program files\Borland\Delphi7\RBuilder\Tutorials\Complete\II. Applications\01. Reporting\rbPrvDlg.pas

just copy this into your project catalog, then add it to your project. Then you can manipulate the preview window just the way you want
0
 
LVL 5

Accepted Solution

by:
Darth_helge earned 45 total points
ID: 11760150
I didn't read your question good enough i think. You say filter BEFORE the display of a report? Here's what I do.

Drop these components at the form
type
  TForm1 = class(TForm)
    ppDBPipeline1: TppDBPipeline;
    ppReport1: TppReport;
    ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

Get your ADOConnection right.
Connect your AdoQuery to the AdoConnection.
Write your SQL query in the SQL property of the ADOQuery. like 'select * from MyTable'
Connect The DataSource1 to the AdoConnection.
Connect The ppDBPipeline to the DataSource1.
Connect The ppReport1 to the ppDBPipeline.

As you can see I have two buttons here. The buttons sort by different columns from your table. The jyst add some text to the SQL Query you have written in the SQL property of the ADOQuery1.
Like This:

procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.SQL.Text := ADOQuery1.SQL.Text + ' Order by MyColumn1';
ADOQuery1.Active := true;
ppreport1.Print;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ADOQuery1.SQL.Text := ADOQuery1.SQL.Text + ' Order by MyColumn2';
ADOQuery1.Active := true;
ppreport1.Print;
end;
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:joshfly
ID: 11768925
sorry, i mean i wants to display the sentence "Sort By : MyColumn_Name" in the report, the way you said just order the records. I want to display the report's filter in the report which the user had selected. can i?

Example :
if the user wants to sort the records according to the customer_id, how can i display a sentence "Sort By : Customer ID" in the report

Thank you
you sure will gain this points from me Darth_helge after solve this problem

josh ;)
0
 

Author Comment

by:joshfly
ID: 11769214
well..haha
i got the solution by myself already...
anyway thanks for your reply for my post...
i still award this points for you, im really appreciate for who spent their valuable time to slove my problem....thanks again Darth_helge

:)
josh
0
 
LVL 5

Expert Comment

by:Darth_helge
ID: 11770149
thanx. I guess I didn't understand your question good enough. what did you do then?
0
 

Author Comment

by:joshfly
ID: 11789871
oh...sorry for late reply..
it's easy, simply just rename the pplabel.caption only using coding.

:)
josh
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
How to debug For loops? 3 57
When i run adoquery my application freezes 26 181
Tembedded WB animatid gifs not animated on some pcs 2 84
JAudiorecorder record freezing the app 29 76
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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