• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4539
  • Last Modified:

QuickReport Problem

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
mokule
Asked:
mokule
  • 9
  • 9
  • 2
  • +5
5 Solutions
 
AshokCommented:
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
 
mokuleAuthor Commented:
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
 
AshokCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
mokuleAuthor Commented:
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
 
AshokCommented:
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
 
AshokCommented:
0
 
mokuleAuthor Commented:
It has nothing to do with my problem
0
 
AshokCommented:
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
 
AshokCommented:
Never mind my previous post.

Ashok
0
 
BlackTigerXCommented:
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
 
mokuleAuthor Commented:
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
 
AshokCommented:
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
 
mokuleAuthor Commented:
Missed shot :(
0
 
AshokCommented:
At least it did not cost anything for trying, right?

Ashok
0
 
mokuleAuthor Commented:
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
 
TheRealLokiSenior DeveloperCommented:
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
 
TheRealLokiSenior DeveloperCommented:
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
 
JaccoCommented:
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
 
calinutzCommented:
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
 
kretzschmarCommented:
can u not simple type in (instead of select from a combo) like

datamodule1.adoquery1

?

(currently no delphi on hand)
0
 
mokuleAuthor Commented:
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
 
AshokCommented:
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
 
cula99Commented:
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
 
mokuleAuthor Commented:
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
 
cula99Commented:
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
 
mokuleAuthor Commented:
This not what I've expected, but thanks for Your efforts.

mokule
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 9
  • 9
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now