LazReport + a View + a Ztable lazarus / 16-Databases ---------------------------------------------------------------------- cpalx · 2009-02-24 17:15 Hello, i have a database in postgreSQL 8.3, a have a connection with Zeos. I want to make a report using Lazreport and a view to able to use a Ztable, but i have no idea how to make it read the view. I would appreciate you ideas. ---------------------------------------------------------------------- jesusr · 2009-02-24 19:50 VERIFY First make sure that you really got what you want to show in report, use a dbgrid connected to the ZTable to confirm this (I assume ZTable is TDataset descendant) you should see all rows in the right order you what them. CREATE REPORT 1. If you have already installed LazReport, find the LazReport tab in Component Palette, pick a TfrReport component and drop it in form designer, do the same with a TfrDbDataset component. 2. Select frDbDataset1 and from property Dataset in object inspector select the ZTable component. 3. Select frReport1 and from property Dataset in object inspector select frDbDataset1 4. Right click frReport1 component and select "Design Report" 5. Select your printer in File->Report Options; 6. Select your Page size in File->Page Options; 7. Select Tools->Tools->Insert DB Fields. Select the fields you want to include (use CTRL+CLICK o SHIFT+CLICK to select individual or ranges of fields), select options "Include headers" and "Include bands". LazReport designer will create a Page Header and a MasterData band and will fill it with the fields you have selected.  Make sure ZTable is active to make this work. 8. Save your report and close Report Designer. SHOW THE REPORT Add a button to your form and double click it. Write something like: frReport1.LoadFromFile('ThePathWhereTheReportIsSaved.lrf'); frReport1.ShowReport; That should do it. ---------------------------------------------------------------------- cpalx · 2009-02-24 21:51 i think i did not write well, sorry i say what i did: I have a postgreSQL conecction I have a Zquery (Zeos Query) and any query works perfectly I have a Ztable (Zeos Table) and i can connect to any table i have (obviusly) i have some reports using LazRports that works perfectly with Zquery, and Ztable (when i use a really table) my problem: i would like to use a "view" to use in my report, i have the view create like: create view XXXX as select ........... any idea? ---------------------------------------------------------------------- Marc · 2009-02-24 23:31 You want the create the view on the DB with lazarus (usually not so good idea in a multiuser environment) or do you want to access the view you have created on the DB ? In the latter case, just use a zquery and select from it (or use a ztable). For postgres there is no difference between a view and a table. ---------------------------------------------------------------------- cpalx · 2009-02-25 14:28 thanks