Bug 112165 - Trying to open a report from form button crashing Base
Summary: Trying to open a report from form button crashing Base
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.3.4.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-01 17:57 UTC by c18florentino
Modified: 2017-12-31 18:36 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Empty database with form & button calling the report (14.91 KB, application/vnd.sun.xml.base)
2017-09-01 19:24 UTC, c18florentino
Details
Message from error handler (98.50 KB, image/png)
2017-09-01 19:26 UTC, c18florentino
Details

Note You need to log in before you can comment on or make changes to this bug.
Description c18florentino 2017-09-01 17:57:40 UTC
ThisDatabaseDocument.ReportDocuments.getByIndex(0).open
On Error Goto 0 
Exit Sub
Erro: MsgBox "ERRO " + Err + Chr$(13) + Error$  + " (linha: " & Erl & ")"
On Error Goto 0 

No error handling.
Program just crashes and I need to recover it.
Java 1.8.0_144 (64)
W10 - 1703
Comment 1 Xisco Faulí 2017-09-01 18:12:16 UTC Comment hidden (obsolete)
Comment 2 c18florentino 2017-09-01 19:24:40 UTC
Created attachment 135940 [details]
Empty database with form & button calling the report

Please note that in this empty database error handling is working.
If I can attach picture of error message?
Don't know how to attach 2 files (?)
In the real database Base crashes but I can manually open the desired report.
Comment 3 c18florentino 2017-09-01 19:26:29 UTC
Created attachment 135941 [details]
Message from error handler
Comment 4 Julien Nabet 2017-09-03 13:26:12 UTC
c18florentino: you can't attach 2 files in the same action, either you'll use several times https://bugs.documentfoundation.org/attachment.cgi?bugid=112165&action=enter or you can compress your files in 1 (zip or tar.gz).
Comment 5 Robert Großkopf 2017-12-31 08:43:55 UTC
Have tested this one.

Couldn't reproduce a crash. LO shows the same error while opening a report without connection to a datasource and opening the same report by macro.

Tested with LO 5.4.4.2 on OpenSUSE 42.2 64bit rpm Linux.

If crash doesn't appear in this empty database: We need an example, which produces the crash.
Comment 6 c18florentino 2017-12-31 11:18:03 UTC
"LO shows the same error while opening a report without connection to a datasource and opening the same report by macro."
Ok. So it's a bug, right?
Comment 7 c18florentino 2017-12-31 13:43:50 UTC
Ok... tested again original front-end (.odb connected to Oracle XE) and now it works fine.
LO 5.4.3.2 (x64)

But you can see in the example I uploaded that report doesn't open up.
When connected to the database, LO crashed.

Thanks for your attention.
Comment 8 Julien Nabet 2017-12-31 15:08:14 UTC
On pc Debian x86-64 with master sources updated today, I gave it a try after having put macro security to Medium.
1) when trying to open the report, I got an error message "The document "rptBug" could not be opened
2) when trying to run the macro with Tools/Macros/Run Macro..., selected "AbrirRelatorio" in <file>/Standard/Module1, I got:
A Scripting Framework error occurred while running the Basic script Standard.Module1.AbrirRelatorio.

Message: wrong number of parameters!

3) when trying to run the macro with Tools/Macros/Organize macros/LO Basic, Edit "AbrirRelatorio", F5, same error as 1)

In brief, I got same results as Robert had in comment 5

To respond to your question, I don't see bug here for the moment.
Comment 9 Robert Großkopf 2017-12-31 15:26:09 UTC
(In reply to c18florentino from comment #6)
> "LO shows the same error while opening a report without connection to a
> datasource and opening the same report by macro."
> Ok. So it's a bug, right?

No, it isn't. The report needs a datasource. Without a datasource it will fail to execute. LO doesn't crash and gives an error-dialog.
Comment 10 c18florentino 2017-12-31 15:36:48 UTC
As I've said, originally report WAS connected to DB (as today and it worked).
LO crashed.
So, a LO Report cannot have only labels on it?
A "recordset" ou "recordsource" is a REQUIRED parameter for these objects to open?
Comment 11 Robert Großkopf 2017-12-31 15:52:03 UTC
(In reply to c18florentino from comment #10)
> As I've said, originally report WAS connected to DB (as today and it worked).
> LO crashed.
> So, a LO Report cannot have only labels on it?
> A "recordset" ou "recordsource" is a REQUIRED parameter for these objects to
> open?

Indeed, the first you are asked for when creating a report is a datasource. You could create a query, which doesn't ever show any content > the report would open without any content. Have tested this with your example-database.

The macro you added in the database produces a crash here:
Sub AbrirRelatorio (e As Object)
On Error Goto Erro
ThisDatabaseDocument.ReportDocuments.getByIndex(0).open
On Error Goto 0 
Exit Sub
Erro: MsgBox "ERRO " + Err + Chr$(13) + Error$  + " (linha: " & Erl & ")"
On Error Goto 0 	
End Sub

This macro won't be executed, if the report won't open. But if the report will open it is looking for '0' - where should it be? '0' is a number, not text where the macro could jump to.

Sub AbrirRelatorio
ThisDatabaseDocument.ReportDocuments.getByIndex(0).open
End Sub

will open the report, if connected to a datasource. No problem if the table or query is empty ...
Comment 12 c18florentino 2017-12-31 17:58:45 UTC
Goto 0 is the exception handling. It deactivates & resets error information status. Has nothing to do with the report.

"the first you are asked for when creating a report is a datasource."
No. I can open a blank report on editor (without assistant) and draw labels or insert images...
But if you say LO requires a resultset as a parameter - ok, understood.
I repeat: it WAS connected to a table.
In my experimental setup here I mantained the button who calls the macro opening the repor and now it worked.
I think it is the new version of LO we are now using.
This report is a receipt. User selects date (time period) and other customer info, previews the $ amount and fills extended value as desired.
Then clicks the button and receipt is generated.
It worked as desired except that the reported needed to be open manually in the Reports section of Base.
Now the button is workinf as desired originally.
I know this isn't a Forum, so thank you and really now there isn't bug.
Comment 13 Robert Großkopf 2017-12-31 18:36:55 UTC
(In reply to c18florentino from comment #12)
> 
> "the first you are asked for when creating a report is a datasource."
> No. I can open a blank report on editor (without assistant) and draw labels
> or insert images...

When I start to create a report here without wizard in a database I get this:
The editor takes the first available datasource and offers me the dialog for putting fields (from this datasource) to this report. This behavior hasn't been changed since I am working with Base (and published the first Base-Handbook). I have to delete the content for data, if I will create a report without datasource - or there isn't any datasource (table, query, view) in the *.odb-file.

> But if you say LO requires a resultset as a parameter - ok, understood.

Could be the appearing dialog is misleading or we should allow to create reports without data. Feel free to write a new bug (as feature-request) for this.

> Now the button is working as desired originally.
> I know this isn't a Forum, so thank you and really now there isn't bug.

So I will set this bug to RESOLVED and WORKSFORME.