Autore Topic: Campi che non vengono stampati su Report  (Letto 603 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.720
  • Ne mors quidem nos iunget
    • Mostra profilo
Campi che non vengono stampati su Report
« il: 09 Febbraio 2014, 23:05:23 »
Vi riporto queta discussione apparsa sulla M.L. ufficiale:


" Hello,

I'm blundering through my first report. I've looked at the examples and
tried the same code as in report1. Had to make some modifications to
connect to MySQL Database. The report contains a ReportVBox called
RVBCont and a ReportLabel called ReportLabel1.

The code is below:

Codice: gambas [Seleziona]
Public Sub _new(sType As String)

   Dim $Query As String
   Dim Rlbl As ReportLabel
   Dim strTest As String

   $Query = "SELECT tblneighborhood.* FROM tblneighborhood ORDER BY
Last_Name, First_Name LIMIT 10;"
   hResult1 = modMain.$Con.Exec($Query)
   hResult1.MoveFirst
   'Report.Debug = True
   'ReportPanel1.DataCount = hResult1.Count
   strTest = CStr(hResult1.Count)

   For Each hResult1

     Rlbl = New ReportLabel(RVBCont)
     Rlbl.Autoresize = True
     Rlbl.Text = hResult1!Last_Name & " " & hResult1!First_Name
     strTest = Rlbl.Text
     Rlbl.Border.bottom.Width = "1px"

   Next

End

The report appears to run. Looking a strTest shows that the names are in
the Rlbl.Text property.  Nothing prints on the report preview. It is
blank. In the debug widow is the message "gnome keyring couldn't connect
to /tmp/key-ring-nWROjb/pkcs11 - No such directory".

I'm using Gambas 3.5 on Ubutu 12.04 LTS.

By the way I did look a Fabien's sight but I do not speak French. Maybe
some one could suggest a good reference in English.

Thanks,
Marty
"


" try to put autoresize to true on the ReportVBox
(it's defult size is 0) or it's expand property to true

This is a thing i want to change on the reportcontrol definition ...
they must have at less 1 cm of hight/width... but it's not so simple
when many report known the default to be at 0

Another thing


Add a reportHbox in the reportVBox in the report editor. Set its height as 1 cm

add in it a reportLabel name it lblField and delete the text property content.


then in the code
Codice: gambas [Seleziona]
Public Sub _new(sType As String)

   Dim $Query As String
   Dim Rlbl As ReportLabel
    Dim strTest As String

   $Query = "SELECT tblneighborhood.* FROM tblneighborhood ORDER BY
Last_Name, First_Name LIMIT 10;"
    hResult1 = modMain.$Con.Exec($Query)

  ReportHBox1.DataCount = hResult1.Count
end

Public sub lblField_Data(Index as integer)

  hResult1.MoveTo(Index)
  Last.Data = hResult1!Last_Name & " " & hResult1!First_Name
end


Fabien "


" Fabien,

Thanks for your reply. I tried your first suggestion. Changed autoresize
and expand to true  on the reportvbox. Still nothing prints.

Tried your second suggestion. Added reporthbox in reportvbox. Added
lblField to reporthbox with empty text content. Add lblField_Data(Index
as Integer) sub also.

No results. In debug the main routine ends and the data sub does not
execute. The reporthbox.DataContent = 10.

New code:

Codice: gambas [Seleziona]
Public Sub _new(sType As String)

   Dim $Query As String
   Dim strTest As String

   $Query = "SELECT tblneighborhood.* FROM tblneighborhood ORDER BY
Last_Name, First_Name LIMIT 10;"
   hResult1 = modMain.$Con.Exec($Query)
   'Report.Debug = True
   ReportHBox1.DataCount = hResult1.Count
   strTest = CStr(ReportHBox1.DataCount)

End

Public Sub lblField_Data(Index As Integer)

   hResult1.MoveTo(Index)
   Last.Data = hResult1!Last_Name & " " & hResult1!First_Name

End

The  height of the reporthbox is set to 1 cm.

Other suggestions?

Thanks,
Marty
"


" Did a little more debugging and found that the lblField data event does
cycle through the ten records. I can see each one in the console local
variables. So it must have to due with the different boxes on the
report. Something prevents the displa of the data.

Marty
"
« Ultima modifica: 10 Febbraio 2014, 13:34:26 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.720
  • Ne mors quidem nos iunget
    • Mostra profilo
Re: Campi che non vengono stampati su Report
« Risposta #1 il: 10 Febbraio 2014, 15:40:31 »
...continia...


" Appears as though I cannot attach the Gambas project directory. Too many
files to attach. It will not just attach the directory. If there is a way to
get it to you, please let me know.  I've taken it out of the more complex
application so that we can deal with it alone. Also the data is
confidential. I have removed the login and password data as well as the
database name. Any simple MySQL data table with about ten records will do.
This time I set every control to autoresize and expand including the report.
Now it works properly. It displays ten names. The vertical spacing is not as
I would want it. It's much too much. Would like to see each line close to
the one above. But, for now this is progress.



Thanks for your continued help.



Marty
"
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »