?
Solved

QuickReport Problem

Posted on 2005-02-28
26
Medium Priority
?
4,475 Views
Last Modified: 2013-11-22
Hi,
I've got a project written in Delphi 5.
I've got a problem with TQRExpr fields when opened this project in Delphi 7.
When I try to use Expression Wizard, the Select Dataset listbox is empty.
What is the reason and how to solve it?

mokule
0
Comment
Question by:mokule
[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
  • 9
  • 9
  • 2
  • +5
26 Comments
 
LVL 13

Expert Comment

by:Ashok
ID: 13422023
I have use QuickReports may times, but not recently.
Can you try this?

Create new project, drop Quickreport, and use TQRExpr.
In Expression Wizard try to Select Dataset....

Ashok
0
 
LVL 17

Author Comment

by:mokule
ID: 13422075
But the problem is that my Datasets located in DataModule are not visible. The Select dataset list box is empty.
When i place some dataset on the same form as report it is visible in this listbox.
But I want to have datasets in data module
mokule
0
 
LVL 13

Expert Comment

by:Ashok
ID: 13422129
implementation

uses Unit2;   // replace Unit2 with name of your Data Module unit name here....

 mokule,

Do you have your data module unit name in implementation of your QuickReport form?

Ashok
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 17

Author Comment

by:mokule
ID: 13422301
Yes, I've got this declaration
Datasets are visible for TQRDBText but not for TQRExpr.
Have You got Delphi 7? Can You try the solutions You suggest?
mokule
0
 
LVL 13

Expert Comment

by:Ashok
ID: 13422318
Here at work, we have Delphi 7, but QuickReport components are not installed.

When I go home, I will try to fix the problem.

Ashok
0
 
LVL 13

Expert Comment

by:Ashok
ID: 13422465
0
 
LVL 17

Author Comment

by:mokule
ID: 13422534
It has nothing to do with my problem
0
 
LVL 13

Expert Comment

by:Ashok
ID: 13422581
by reading the article, it seems to me that you
do not have to specify Datset for TQRExpr.

Only specify Dataset for TQuickRep component.

I have to try this at home.

Ashok
0
 
LVL 13

Expert Comment

by:Ashok
ID: 13422671
Never mind my previous post.

Ashok
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 13423294
you do have a dataset (ADOTable, ADOQuery, etc) on your form or in a datamodule, which is in the uses clause (after Interface)
right?
0
 
LVL 17

Author Comment

by:mokule
ID: 13424106
Yes,
I have datasets (ADOTable, ADOQuery, etc) in a datamodule, which is in the uses clause.
I've tried after Interface and implementation with no success.

I'll be grateful for any example using TQREpr with Dataset from other units, in Delphi7

Anybody using QuickReport in D7?

mokule
0
 
LVL 13

Assisted Solution

by:Ashok
Ashok earned 150 total points
ID: 13424530
I am using Delphi 7.
I tried to assign Expression using ADOTable from Data Module, it does not appear in Expression Wizard.

Here is the trick I want you to try.
Copy ADOTable component from DataModule to the form which has QRExpr.
Set Active := True (in order to see all fields in Expression Wizard)
Build Expression using this.  Leave it on the form. Once the expression is built, Set Active := False

Set QuickRep1.DataSet in Object Inspector to use ADOTable from DataModule.
Set
QRExpr1.Master := QuickRep1  (In Object Inspector)

Try to run the eport.
I hope it will use the correct dataset.
If not, manually modify expression so that
you change "Table1.FirstName" to "Datamodule1.Table1.FirstName" for example.

Ashok
0
 
LVL 17

Author Comment

by:mokule
ID: 13424824
Missed shot :(
0
 
LVL 13

Expert Comment

by:Ashok
ID: 13424934
At least it did not cost anything for trying, right?

Ashok
0
 
LVL 17

Author Comment

by:mokule
ID: 13425038
Not quite, it costs time.
At the moment I think that I resign from using TQRExpr.
I must do the same using ADOQuery, though it costs me quite a lot of work.
Seems there is no choice :(
mokule
0
 
LVL 17

Assisted Solution

by:TheRealLoki
TheRealLoki earned 150 total points
ID: 13425446
I know this problem
you are correct, the quickreport does not recognize other datasets
1 "workaround" is to put the dataset on the quickreport form
Then your qrexpr will see it and use it just fine
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 13425580
another workaround if you must (not using qrexpr) is to simply use a TQRLabel, and use the band's "beforeprint" event to populate the label.  e.g.  qrlabel1.caption := unit3.table1PRODUCTNAME.AsString;
if it's any consolation, I know there is a way to do QRExpr
does the quickreport have a "datamodule" (no.. not dataset)  property or something?
0
 
LVL 10

Assisted Solution

by:Jacco
Jacco earned 150 total points
ID: 13426989
The expression builder will show all TDataSet descendants on the same form as the report or on any created DataModule when the application is running. (Also TADOQueries will be shown).

Some change in D7 makes the DataModules not appear in Screen.DataModules when in the IDE (not running)

If you use QREditor and edit reports while running an application things will work correctly.

Regards Jacco
0
 
LVL 11

Assisted Solution

by:calinutz
calinutz earned 150 total points
ID: 13427000
To use QRexpr you only need to use the fields from your query in simple mathematic functions (add,substract and so on).
I'll give you an example.
On your detail band you have (let's say) the following fields (QRDBText):

== A few steps to follow
1. From your DataModule Query... select name,agent,code from table order by agent
2. You connect the DataSource to your Query (in the DataModule)
3. After that you place the DataModule in the QReport uses list.
4. You assign the QuickReport dataset property to the Query's DataSource (from the DataModule)
5. Place 2 QRDBText components on the Detail band of the QReport and assign them the fields name and agent.
6. Place a QRExpr on the same detailBand and on the expression property place this text: name+agent

This way you will get on the preview the result of the adding of the 2 string fields.
I guess this is what you needed.

On the expression property you can also place functions like SUM(value) if you have on your query a "value" field and you will get the obvious result (place it on the summary band to get the sum of all the "value" records from the query).
You just have to try any other functions you need. This is how I use the QRExpr. There may be other ways to use it but I did not really dig into that. I got what I needed from this means of usage so it was not necessary for me to dig further
Cheers
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 13427112
can u not simple type in (instead of select from a combo) like

datamodule1.adoquery1

?

(currently no delphi on hand)
0
 
LVL 17

Author Comment

by:mokule
ID: 13427382
to kretzschmar
  unfortunately it doesn't work

to calinutz
  by Your method I can use expressions with fields from only 1 dataset in a report , am i right?

mokule
0
 
LVL 13

Expert Comment

by:Ashok
ID: 13428239
mokule

If you give more detail about "what is your expression string?", someone can better help you.
I have never had to use QRExpr so I did not have any problem.

Whatever you are trying to do can be achieved by just using QRLabel.

Just like TheRealLoki suggested.

Have you tried  Jacco solution if you want to use QRExpr ?  (which is trying to use Datamodule at runtime)

Ashok
0
 
LVL 2

Accepted Solution

by:
cula99 earned 150 total points
ID: 13437121
I have the same "problem",tables are in datamodule. In expresion bilder I can't see tables and queries from module only the ones at the form. But everything is working fine when I manualy write string into expresion. If you are not familiar to make expresion without bilder put temperary table on to form with report and make expression, then remove table and rename table names in the expression. If you can access data in tables and queries with TQRDBText
My project is big and it is first compiled in delphi 5 then 6 and now I work in delphi 7.

Cula
0
 
LVL 17

Author Comment

by:mokule
ID: 13438037
to cula99

can You be so kind and supply an example, what should I write in an Expression?
Suppose my datamodule is DM1 my table is atFirma and fields fir_nazwa1, fir_nazwa2
condition: atFirma IS NOT TQuickRep DataSet

I've tried
Expression := atFirma.fir_nazwa1+atFirma.fir_nazwa2;
or
Expression := DM1.atFirma.fir_nazwa1+DM1.atFirma.fir_nazwa2;

result Unknown function atFirma.fir_nazwa1 or Unknown function DM1.atFirma.fir_nazwa1

mokule

0
 
LVL 2

Expert Comment

by:cula99
ID: 13439948
This is when atFirma IS TQuickRep DataSet

QuickReport1.DataSet := DM1.atFirma;

QRExpr1.Expression := atFirma.fir_nazwa1+atFirma.fir_nazwa2;

but if not try to use CompositeReport where will you assign atFirma to TQuickRep2.DataSet and join it with first

Čula
0
 
LVL 17

Author Comment

by:mokule
ID: 13485906
This not what I've expected, but thanks for Your efforts.

mokule
0

Featured Post

Independent Software Vendors: 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…
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…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 6 hours left to enroll

764 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