S.A
Başlık yeterince açıklayıcı oldu sanırım bir türlü yapamıyorum bilen varsa anlatırsa sevinirim hem forumda arattırdım bulamadım...
Kolay gelsin..
Rave de master detail raporlama?
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
- ömer faruk
- Üye
- Mesajlar: 97
- Kayıt: 29 Eki 2003 09:34
- Konum: Bursa
- İletişim:
Rave de master detail raporlama?
Hakimiyet ALLAH' ındır...
-
- Kıdemli Üye
- Mesajlar: 574
- Kayıt: 01 Şub 2004 12:29
- Konum: Erdemli - MERSİN
Hocam aşağıdaki yazıyı bir inceleyin. Takıldığınız yer varsa çevirmede yardımcı olurum.
QuestionHow do I create a Master-Detail report with SQL Data Views?
Solution
The fundamental process for creating master-detail reports requires linking data bands by setting the MasterDataView, MasterKey, and DetailKey properties on the detail band (as well as its Detail property). If the data views involved are SQLDataViews, however, and additional step is required, whereby the underlying queries are linked through a parameter. If you've ever created linked queries in Delphi or C++, the modification of the detail query will be familiar.
Suppose we wish to create a master-detail report listing customers and their orders, out of the DBDEMOS database. To do this we create a datbase component, and then a Customers SQL Data View (name: CustomersDV) and an Orders SQL Data View (name: OrdersDV connected to this database. The core query text for these data views would be:
In order to allow the report to show the correct detail with a given master row, however, we must add an SQL parameter to the detail query text, one specifying the master row key:
Then, using the Parameters tab of the SQL Property Editor for the Orders SQL data view, we add a parameter specification which instructs RAVE where to find the SQL parameter value when the detail query is opened:
Note the format here: an SQL parameter name (without the ":" prefix), an equals sign as an assignment operator, followed by a data view field specification of the form <SQL Data View Component Name>.<Query Field Name>.
Once the data views have been properly set up, construction of the report proceeds precisely as if you had based it on direct data views. Note also that, if you use Rave's Master-Detail Report Wizard to construct the report, the Wizard will not link the queries automatically for you.
QuestionHow do I create a Master-Detail report with SQL Data Views?
Solution
The fundamental process for creating master-detail reports requires linking data bands by setting the MasterDataView, MasterKey, and DetailKey properties on the detail band (as well as its Detail property). If the data views involved are SQLDataViews, however, and additional step is required, whereby the underlying queries are linked through a parameter. If you've ever created linked queries in Delphi or C++, the modification of the detail query will be familiar.
Suppose we wish to create a master-detail report listing customers and their orders, out of the DBDEMOS database. To do this we create a datbase component, and then a Customers SQL Data View (name: CustomersDV) and an Orders SQL Data View (name: OrdersDV connected to this database. The core query text for these data views would be:
Kod: Tümünü seç
Customers: SELECT C.* FROM CUSTOMERS C
Orders: SELECT O.* FROM ORDERS O
Kod: Tümünü seç
Orders: SELECT O.* FROM ORDERS O WHERE O.CUSTNO = :CUSTNO
Kod: Tümünü seç
CUSTNO = CustomersDV.CUSTNO
Once the data views have been properly set up, construction of the report proceeds precisely as if you had based it on direct data views. Note also that, if you use Rave's Master-Detail Report Wizard to construct the report, the Wizard will not link the queries automatically for you.
- ömer faruk
- Üye
- Mesajlar: 97
- Kayıt: 29 Eki 2003 09:34
- Konum: Bursa
- İletişim:
rave reportta master-detail rapor oluşturma
master tablo:customer
detail tablo:order
form üzerinde edite girile müşteri numarasına göre yapılan satışları raporlama.form üzerinde iki TTable bir TRvsystem nesnesi kullandım.
tablelerin bağlantısını yapıldığını varsayarsak:[/code][/list]
detail tablo:order
form üzerinde edite girile müşteri numarasına göre yapılan satışları raporlama.form üzerinde iki TTable bir TRvsystem nesnesi kullandım.
tablelerin bağlantısını yapıldığını varsayarsak:[/code][/list]
Kod: Tümünü seç
{detail tablo(customer) için kolon başlıklarını ayarla }
procedure TForm1.SetupTabs;
begin
with rvsystem1.BaseReport do begin
ClearTabs;
SetTab(0.2, pjLeft, 1.1, 0, 0, 0);
SetTab(1.1, pjRight, 2.1, 0, 0, 0);
SetTab(2.1, pjRight, 3.1, 0, 0, 0);
SetTab(3.1, pjRight, 4.1, 0, 0, 0);
SetFont('Arial',15);
Bold := True;
UnderLine:=true;
PrintTab('Satış No');
PrintTab('Müşteri No');
PrintTab('Satış Tarihi');
PrintTab('Sipariş Tarihi');
Bold := False;
UnderLine:=false;
NewLine;
NewLine;
end;
end;
{Rapor başlığı oluştur}
procedure TForm1.RvSystem1PrintHeader(Sender: TObject);
begin
with Sender as TBaseReport do begin
SectionTop := 0.1;
SetFont('Tahoma', 14);
Bold := True;
Underline := True;
PrintHeader('Müşteri Listesi', pjCenter);
SectionTop := 1.0;
end;
end;
{her rapor sayfası altında sayfa no ve tarih bilgisi görünsün}
procedure TForm1.RvSystem1PrintFooter(Sender: TObject);
begin
with Sender as TBaseReport do begin
SectionBottom := 10.75;
SetFont('Tahoma',8);
PrintFooter('Sayfa '+IntToStr(CurrentPage),pjLeft);
PrintFooter('Tarih '+DateTimeToStr(Now),pjRight);
end;
end;
{rapor ekran çıktısı}
procedure TForm1.RvSystem1Print(Sender: TObject);
begin
//tam ekran modunda göster
rvSystem1.SystemPreview.FormState:=wsMaximized;
with Sender as TBaseReport do begin
SectionTop := 1.0;
SectionBottom := 10.5;
SectionLeft := 0.5;
SectionRight := 8.0;
//customer tablodaki başlık ve alanları göster
rvSystem1.BaseReport.GoToXY(1,0.25);
rvsystem1.BaseReport.SetFont('Arial',10);
rvSystem1.BaseReport.Print('Müşteri No: '+tblCustomers.Fields[0].AsString);
rvSystem1.BaseReport.GoToXY(1,0.45);
rvsystem1.BaseReport.SetFont('Arial',10);
rvSystem1.BaseReport.Print('Şirket: '+tblCustomers.Fields[1].AsString);
rvSystem1.BaseReport.GoToXY(1,0.65);
rvsystem1.BaseReport.SetFont('Arial',10);
rvSystem1.BaseReport.Print('Adres1: '+tblCustomers.Fields[2].AsString);
//4 satır aşağı kay
NewLine;
NewLine;
NewLine;
NewLine;
//detail tablo(order) kolon başlığı ayarlama prosedürünü kullan
SetupTabs;
//order tablo için alan fontunu ayarla
SetFont('Arial',10);
//order tablodaki alan bilgilerini göster
tblOrders.First;
while not tblOrders.Eof do begin
Print(#9+tblOrders.FieldByName('OrderNo').AsString);
Print(#9+tblOrders.FieldByname('CustNo').AsString);
Print(#9+tblOrders.FieldByname('Saledate').AsString);
Println(#9+tblOrders.FieldByName('ShipDate').AsString);
tblOrders.Next;
//ilk sayfanın sonu ise yeni sayfa oluştur
if YPos > SectionBottom then begin
NewPage;
SetupTabs;
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
//edite girilen müşteri numarasına göre rapor göster
tblCustomers.Locate('CustNo',edit1.Text,[]);
rvsystem1.Execute;
end;