หลักการสร้าง Lazreport เพื่แสดงข้อมูลจาก Database ซึ่ง
จะแสดงรายงานข้อมูลตาม Query ที่ได้กำหนดไว้แล้วเท่านั้น
แต่มีปัญหาการสร้างรายงานที่พบบ่อย พอจะสรุปเป็น 3 ประเด็น
ดังนี้
1.การส่ง(Pass)ค่าตัวแปรจากภายนอกรายงานให้แสดงในรายงาน
ให้ทำดังนี้
-Create a report and place a "Text" object in it. Type the following text into this object:
เช่น
[var_office]
Now create the “frxReport.OnGetValue” event handler:
procedure TForm1.frReport1GetValue(const ParName: String; var ParValue: Variant
  );
begin
  if ParName='var_office' then
   ParValue:='สำนักงาน';
end; 
         หมายเหตุ: สามารถรับค่าตัวแปรได้ครั้งละหลายๆตัว
2.การใช้ Count() เพื่อนับจำนวน record ใน report ดังนี้
       [COUNT([SQLQuery_report."rec_id"], Masterdata1)]
        หมายเหตุ: .ให้พิมพ์ใส่ Masterdata1 ซึ่งเป็นชื่อ band ไม่งั้นจะไม่คำนวณ
3.การนับจำนวนหน้า ด้วยTOTALPAGESให้ทำงาน
ต้องไปกำหนด 
File ==> Report Options 
and check "Two pass report"
and check "Two pass report"
4.การใช้ report band
ReportTitle is a band, that printed only at first page.
PageHeader, to print title at every page.


 
ไม่มีความคิดเห็น:
แสดงความคิดเห็น