Solved

Report Builder

Posted on 2004-08-09
7
1,083 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

930 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

10 Experts available now in Live!

Get 1:1 Help Now