Solved

Report Builder

Posted on 2004-08-09
7
1,072 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:joshfly
Comment Utility
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
Comment Utility
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
Comment Utility
thanx. I guess I didn't understand your question good enough. what did you do then?
0
 

Author Comment

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

:)
josh
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

13 Experts available now in Live!

Get 1:1 Help Now