Reports - Determine when table finished filling data

Discuss the database features
Post Reply
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Reports - Determine when table finished filling data

Post by arfgh »

Hey there friends.
Just need to determine from macro level when the loaded report finished to fill the table with the data.
I have explored the events, and none of them seems to help to determine that.
Also i did some MRI exploration without success....
Reason to need that determine is to implement other subroutine that change data on the columns by hyperlinks, that will help so much for other DB functions i have in mind.

So, how to determine the report finished to fill data in the table ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Reports - Determine when table finished filling data

Post by F3K Total »

Simple:
Open the report by code then you can have access to it when it finished to fill the table with the data:

Code: Select all

    oreportdoc = thisdatabasedocument.reportdocuments.getbyname("NAME_OF_YOUR_REPORT")
    oreport = oreportdoc.open
    MRI oreport
    ...
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: Reports - Determine when table finished filling data

Post by arfgh »

that's the problem, they are opened from the reports section of base by the user....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Reports - Determine when table finished filling data

Post by F3K Total »

Do you want to show, what's not easily doable or solve a real problem?
If the second, give them a button in the form, where they filter the reports content.
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
longi
Posts: 110
Joined: Mon Jul 15, 2013 5:04 pm

Re: Reports - Determine when table finished filling data

Post by longi »

Well
As I could finally catch, I think you want to use a report as a form, in order to use data , not to print them, but you can.
You have to open the report, and in the execution time you have to fill the selected cells with the hyperlinks you have stored somewhere.
In this example, you have a table (the old normal table) and another one in which I put some hyperlinks.
I made a query in order to have an array with the hyperlinks I want, and, in the execution time, I filled every cell I wanted with the specific hyperlink for each row.
You have to be able to modify the query, in order to get the hyperlinks you want to insert, which depends on the report source (in this case both tables are similar, but it is not neccessary this way).

I hope I understood you properly.

Bye! ;)
Attachments
Hyperlink.7z
(60.2 KiB) Downloaded 196 times
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: Reports - Determine when table finished filling data

Post by arfgh »

Longi, that your example. What i need is to determine via macro, when your report 'comarcas' finished to load data, in order to execute other subroutine that will add hyperlinks on one of the columns. The problem i am having is that i am unable to determine via macro when the report finished to do the job. And yes, at the moment i added an event to pass the mouse over to execute that subroutine...
But wanted is to be able to determine when report finished to load.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Reports - Determine when table finished filling data

Post by RoryOF »

Here are two references which may help
http://www.openoffice.org/api/docs/comm ... eable.html
viewtopic.php?f=20&t=37023#p169875

You are the one who needs to do this - it is up to you to investigate how to do it. I have no need to.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
longi
Posts: 110
Joined: Mon Jul 15, 2013 5:04 pm

Re: Reports - Determine when table finished filling data

Post by longi »

As far as I Know, a report is a non editable document, so we are oblied to make changes, if we want, in the execute time.
As you can see in the macro, after the 'open', you has more code, and it is working after the report was finished (and I thought you needed that).
If you have a different macro, you can put a call for it after the 'open' moment, and it will work properly:

Code: Select all

Sub NormalReport
    '--------------------------------------------------------------------
    ' 0 We declare the variables
   
    Dim oreportdoc As Object, ocontroller As Variant
    Dim oTextTable As Variant, oCell As Variant
    Dim oCurs As object, oText As Variant
    '------------------------------------------------------------------------------
    '1º We open our report
   
    ocontroller = Thisdatabasedocument.currentController
    if not ocontroller.isconnected then ocontroller.connect                                        ' The connection
    oreportdoc = Thisdatabasedocument.reportdocuments.getbyname("COMARCAS").open                   ' We open the report
    Call "Your macro"
End Sub
To summarize: a report is a non editable document and I only know this way to modify the original structure.
If you want to modify a column you have to put your code inside the macro (or a call to your macro), and you'll get the result of your code after the report result was loaded.

Bye! ;)
Last edited by longi on Sun Mar 10, 2019 11:32 pm, edited 1 time in total.
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: Reports - Determine when table finished filling data

Post by arfgh »

no, the report is opened via base reports section by iteraction of the user. It is very strange that there are no any events that help on this...
We can edit the loaded report, but the problem is just to determine when finished the loading data into table.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
longi
Posts: 110
Joined: Mon Jul 15, 2013 5:04 pm

Re: Reports - Determine when table finished filling data

Post by longi »

Sorry, but my little knowledge don't permit me to edit a report previously opened.
In my way, I always open a report by a button, in a form, in order to use the total macro, so I can edit it, add a new column or write different texts inside a cell, or put a hyperlink, etc.
So, I recommend to use a button in a form to deal with reports, as a logical way.
If you has different tipe of reports depending of the user, you can change the code in the button, or change the filter of the report depending on the user, etc.
I can't help you more about this topic.

Bye! ;)
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: Reports - Determine when table finished filling data

Post by arfgh »

it is perfectly possible to edit a report previously opened. Like i said before i do it from event, but to do that, first the report must finish the table flill, it is what i want to determine, when did finish.

Calling MR Villeroy....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Reports - Determine when table finished filling data

Post by F3K Total »

Bind it to the .odb's event "Deactivate Document"

Code: Select all

sub main
    sReportName = "Addressdata"
    sExtension = ".odt"
    oActiveFrame = Stardesktop.activeFrame
    do
        wait 10
    loop while ismissing(Stardesktop.currentComponent)
    if instr(oActiveFrame.Title,sReportName) > 0 AND  instr(oActiveFrame.Title,sExtension ) > 0 Then
        print "Report """ & sReportName & """ is loaded"
        oLoadedReportComponent = Stardesktop.currentComponent
        mri oLoadedReportComponent
    endif
end sub
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
longi
Posts: 110
Joined: Mon Jul 15, 2013 5:04 pm

Re: Reports - Determine when table finished filling data

Post by longi »

Sorry!
I always use the SRB, not ORB, so my reports are not editable (one another thing to study in order to change it!)

bye! ;)
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: Reports - Determine when table finished filling data

Post by arfgh »

the main question is about base reports, not ORB. ok F3K Total, i will try that.....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: Reports - Determine when table finished filling data

Post by arfgh »

very curious F3K Total, that event deactivate cause that all into base receive that event... forms, reports, and even main 'untitled 1' base gui screen....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Reports - Determine when table finished filling data

Post by Villeroy »

arfgh wrote:Calling MR Villeroy....
no idea what you're asking for
way over my head
dazzled and confused, sincerely V.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
arfgh
Posts: 566
Joined: Tue Mar 05, 2013 6:44 pm

Re: Reports - Determine when table finished filling data

Post by arfgh »

F3K Total wrote:Bind it to the .odb's event "Deactivate Document"

Code: Select all

sub main
    sReportName = "Addressdata"
    sExtension = ".odt"
    oActiveFrame = Stardesktop.activeFrame
    do
        wait 10
    loop while ismissing(Stardesktop.currentComponent)
    if instr(oActiveFrame.Title,sReportName) > 0 AND  instr(oActiveFrame.Title,sExtension ) > 0 Then
        print "Report """ & sReportName & """ is loaded"
        oLoadedReportComponent = Stardesktop.currentComponent
        mri oLoadedReportComponent
    endif
end sub
Finally i did what i require thx to your help. Anyways can you please explain a bit more about that 'deactivate' event ? because, like i said before, it is running in all base elements even on the main base screen. At the moment i was able to use that way you revealed to wait on certain report while the table is filling data, but also i have been noticed that sometime, for unknown reasons, this way make the entire base to crash.... We need to know more about 'deactivate event'.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Post Reply