Solved

Report Builder

Posted on 2004-08-09
7
1,123 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

696 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