Registriert seit: 4. Nov 2005
Ort: Basel
442 Beiträge
Delphi XE2 Enterprise
|
Reportproblem
10. Jul 2009, 10:48
Datenbank: Firebird • Version: 2.1 • Zugriff über: Fibplus
Hallo zusammen
in einem Report möchte ich eine zusammenfassung div. Tabellen darstellen.
Das Problem ist das die Details immer leer sprich 0 sind.
Delphi-Quellcode:
procedure TDM_member.print_camps_dist_ov(Sender: TObject);
begin
with DM_reports.camps do
begin
close;
SelectSQL.Clear;
SelectSQL.Text :=('SELECT * FROM CAMPS ORDER BY C_NO');
Open;
end;
with DM_reports.Default_OV do
begin
close;
SelectSQL.Clear;
SelectSQL.Add
('SELECT '+
'(SELECT COUNT( NAME ) FROM HOTEL WHERE (C_NO = ?C_NO)) AS COUNT_OF_HOTEL, '+
'(SELECT COUNT( NAME ) FROM CHURCH WHERE (C_NO = ?C_NO)) AS COUNT_OF_CHURCH, '+
'(SELECT COUNT( NAME ) FROM DOCTOR WHERE (C_NO = ?C_NO)) AS COUNT_OF_DOCTOR, '+
'(SELECT COUNT( NAME ) FROM SCHOOL WHERE (C_NO = ?C_NO)) AS COUNT_OF_SCHOOL, '+
'(SELECT COUNT( NAME ) FROM NURSING_H WHERE (C_NO = ?C_NO)) AS COUNT_OF_NURSING_H, '+
'(SELECT COUNT( NAME ) FROM LAWYER WHERE (C_NO = ?C_NO)) AS COUNT_OF_LAWYER, '+
'(SELECT COUNT( NAME ) FROM HOSPITAL WHERE (C_NO = ?C_NO)) AS COUNT_OF_HOSPITAL, '+
'(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = ''10'' and C_NO = ?C_NO) AS COUNT_OF_MILITARY, '+
'(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = ''20'' and C_NO = ?C_NO) AS COUNT_OF_FIRE_BRIGADE, '+
'(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = ''30'' and C_NO = ?C_NO) AS COUNT_OF_POLICE, '+
'(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = ''40'' and C_NO = ?C_NO) AS COUNT_OF_PRISON, '+
'(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = ''50'' and C_NO = ?C_NO) AS COUNT_OF_REFUGEE_CAMP '+
'FROM CAMPS '+
'WHERE C_NO = ?C_NO;');
Open;
end;
// FibPLus Dataset setup end:
with DM_reports.frxReport do
begin
Variables.LoadFromFile(report_dir+'/report_var.fd3');
LoadFromFile(report_dir+'/report_camp_dist_ov.fr3');
DM_reports.set_variables(Sender);
PrepareReport;
ShowPreparedReport;
end;
end;
Wenn ich die abfrage mit IBExport ausführe ist der Datensatz ok:
SQL-Code:
SELECT
C_NO, REG_NO, ZONE_NO, AREA_NO, CITY, COUNTRY, LANG,
(SELECT COUNT( NAME ) FROM HOTEL WHERE (C_NO = 'I47705')) AS COUNT_OF_HOTEL,
(SELECT COUNT( NAME ) FROM CHURCH WHERE (C_NO = 'I47705')) AS COUNT_OF_CHURCH,
(SELECT COUNT( NAME ) FROM DOCTOR WHERE (C_NO = 'I47705')) AS COUNT_OF_DOCTOR,
(SELECT COUNT( NAME ) FROM SCHOOL WHERE (C_NO = 'I47705')) AS COUNT_OF_SCHOOL,
(SELECT COUNT( NAME ) FROM NURSING_H WHERE (C_NO = 'I47705')) AS COUNT_OF_NURSING_H,
(SELECT COUNT( NAME ) FROM LAWYER WHERE (C_NO = 'I47705')) AS COUNT_OF_LAWYER,
(SELECT COUNT( NAME ) FROM HOSPITAL WHERE (C_NO = 'I47705')) AS COUNT_OF_HOSPITAL,
(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = '10' and C_NO = 'I47705') AS COUNT_OF_MILITARY,
(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = '20' and C_NO = 'I47705') AS COUNT_OF_FIRE_BRIGADE,
(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = '30' and C_NO = 'I47705') AS COUNT_OF_POLICE,
(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = '40' and C_NO = 'I47705') AS COUNT_OF_PRISON,
(SELECT COUNT( NAME ) FROM PUB_S WHERE KIND = '50' and C_NO = 'I47705') AS COUNT_OF_REFUGEE_CAMP
FROM CAMPS WHERE (C_NO = 'I47705')
Danke schonmal für Eure Hilfe
Manfred
|
|
Zitat
|