[Gambas-user] Questions about gb.report
Fabien Bodard
gambas.fr at ...626...
Thu Sep 19 22:00:22 CEST 2013
Gambas report is working like the forms
you need to open a new report
then setup the padding of the report (it's margins)
Add a ReportHBox to create the table header
Set it's height to 1 cm
set the property fixed to true (it repeat the header on each page)
in it add one report label for each column
for each label set the header text
give a width for each of then
set the border for each of them
then
on the report add another reporthbox (name=datalist)
set it's height to 1 cm
in it add a reportlabel for each column (datalabel1, datalabel2, etc)
set theire text to null
set theire width to the same size as those of the header
set theire border
then
in _new
hresult=.....
datalist.datacount=hresult.count
for each datalabel :
example :
Public Sub DataLabel1_data(index as integer)
hResult.Moveto(Index)
Last.Data = hResult!myfield
end
to test the report set it as main class (first launched form of the project)
i give you a demo with some extra such as page header, title and page footer
you need to play with all the properties to know exactly what they are
doing.
all the array in my example is in an extra vbo with expand to true. it's to
enforce the footer to be at the end of the page even on the last one (when
datas not fill the page)
remember that a report is a multi container i call it sections. you can get
a new section by increase the property count of report. A section is like a
new report (or a new page)
for exemple with that a report can have a title page, a summary, the data ,
the aknowlegement...
gb.report have not a good doc as i've not the time to inprove it. but it's
really powerfull. And since now not so many people use it.
In a short time (some month i will adda grid widget to simplify the simple
table making)
Have fun
2013/9/19 Willy Raets <willy at ...2734...>
> Hi,
>
> I'm working on my first report in Gambas and I'm getting nowhere.
> I've been reading that someone took 60 hours to get a grasp on it.
> I hope to seriously shorten that time by simply asking here as
> documentation is scarce.
>
> My situation very much simplified (it is part of a big migration project
> from Windows to Linux with Gambas clients, so I can't really send you a
> project).
>
> Table 1 (IC):
> ID | ProductID | RestIC | ActueelIC
>
> Table 2 (Product):
> ProductID | Omschrijving
>
> Goal is to make a report with on top field names followed by data.
> This field names part needs to be on top of each page.
>
> So the result of the report should look like:
>
> ID Omschrijving ActueelIC RestIC '<-- this on every page
>
> 13 A product 1200 240
> 12 Other product 2400 2400
> ...
>
> So there is a header on each page and the body with data.
> I have made a report, but have no idea what to put where and how.
>
> On main form this is my code:
>
> Private $hConnTest As New Connection
>
> Public Sub OpenReport()
>
> Dim rData As Result
> Dim hReport As New RprtIC
> Dim sQuery As String
> sQuery = "SELECT IC.ID, Product.Omschrijving, IC.Actueel.IC, IC.RestIC
> from IC LEFT JOIN Product ON IC.ProductID=Product.ProductID ORDER BY
> IC.ID DESC
>
> rData = $hConnTest.Exec(sQuery)
> hReport = New RprtIC($hConnTest, rData)
> hReport.Preview
>
> End
>
> On the report I have this:
>
> Private $hConn As Connection
> Private $rResult As Result
>
> Public Sub _new(hConn As Connection, rResult As Result)
>
> $hConn = hConn
> $rResult = rResult
>
> End
>
> My questions:
> 1. What objects do I need to draw on the report and where and in what
> order?
> 2. What properties do I need to set on the drawn objects?
> 3. In what objects do I place what data?
>
> I hope when getting this clear to have some basic insight in reports.
>
>
> --
> Kind regards,
>
> Willy (aka gbWilly)
>
> http://gambasshowcase.org/
> http://howtogambas.org
> http://gambos.org
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack
> includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Fabien Bodard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DemoReport-0.0.1.tar.gz
Type: application/x-gzip
Size: 5392 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130919/acfd1f0f/attachment.bin>
More information about the User
mailing list