Page 1 of 1

Reports - Determine when table finished filling data

Posted: Sat Mar 09, 2019 1:01 pm
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 ?

Re: Reports - Determine when table finished filling data

Posted: Sat Mar 09, 2019 6:06 pm
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
    ...

Re: Reports - Determine when table finished filling data

Posted: Sat Mar 09, 2019 6:35 pm
by arfgh
that's the problem, they are opened from the reports section of base by the user....

Re: Reports - Determine when table finished filling data

Posted: Sun Mar 10, 2019 10:20 am
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.

Re: Reports - Determine when table finished filling data

Posted: Sun Mar 10, 2019 1:28 pm
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! ;)

Re: Reports - Determine when table finished filling data

Posted: Sun Mar 10, 2019 6:30 pm
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.

Re: Reports - Determine when table finished filling data

Posted: Sun Mar 10, 2019 7:38 pm
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.

Re: Reports - Determine when table finished filling data

Posted: Sun Mar 10, 2019 8:03 pm
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! ;)

Re: Reports - Determine when table finished filling data

Posted: Sun Mar 10, 2019 8:20 pm
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.

Re: Reports - Determine when table finished filling data

Posted: Sun Mar 10, 2019 11:31 pm
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! ;)

Re: Reports - Determine when table finished filling data

Posted: Mon Mar 11, 2019 12:49 am
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....

Re: Reports - Determine when table finished filling data

Posted: Mon Mar 11, 2019 7:22 pm
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

Re: Reports - Determine when table finished filling data

Posted: Mon Mar 11, 2019 11:32 pm
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! ;)

Re: Reports - Determine when table finished filling data

Posted: Wed Mar 13, 2019 2:00 am
by arfgh
the main question is about base reports, not ORB. ok F3K Total, i will try that.....

Re: Reports - Determine when table finished filling data

Posted: Wed Mar 13, 2019 9:50 pm
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....

Re: Reports - Determine when table finished filling data

Posted: Wed Mar 13, 2019 10:12 pm
by Villeroy
arfgh wrote:Calling MR Villeroy....
no idea what you're asking for
way over my head
dazzled and confused, sincerely V.

Re: Reports - Determine when table finished filling data

Posted: Thu Mar 21, 2019 2:55 pm
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'.