How to open Base reports based on queries in standalone

I made standalone of form’s, its working properly but when same process used for Base reports based on queries,

its open only generate column names but no output queries loaded.

when open in design mode no opens found to load data.

show me correct and clear steps to do standalone for reports.

I think it is not possible. See here: Apache OpenOffice Community Forum - [Tutorial] Standalone Forms / Switchboard - (View topic).

Edit: corrected link.

@charlie.it respectfully, I miss the point of the link in relation to the question. Possibly an incorrect link?

@Ratslinger Thank you, I corrected the link.

@koolninja please start putting more information in your questions such as LO version and operating system. Without this it can be harder to answer (like in this one).

I did get a report to run from a standalone form using Xubuntu 16.04 & LO v5.2.0.4.

First the report must have been created and tested to work in your .odb file. The database must also be registered.

The key to this was noted in the link provided by @charlie.it which mentioned DB Doc Shortcut which I couldn’t find. Today I ran across it (click here) while looking for something else. You download this and install as an extension (menu Tools->Extension Manager...). Once installed you need to run a macro which will create a desktop file. Again from menu Tools->Macros->Run Macro... then under MyMacros->DBDocShortCuts->ModMain run Main (in right panel). This will start a dialog. There are drop downs to make filling in easier. Select Database, Document Type, DB Document, (office & shortcut location already filled in - should be OK), Shortcut Type(I used Bash) and a Label (your choice). Then press Create Shortcut button. As a Test, double click the newly created item and the report should run.

Next you need to connect the push button on the standalone form to the newly created item. In my case it was similar to /home/MY_DIRECTORY/Desktop/ReportTest.bash This was inserted into the URL property on the push button. Tested the button and the report ran fine.

Made on the road, operating system and lo release notes I will remember.

Make a query in the database and then a report on that query.
connect sub main to an button action event.

Sub MAIN
OPENFORM("you report")
End Sub


Sub openForm(FormName as String) 
 Form_id= ThisComponent.Drawpage.forms.MainForm.getByName("Form_id").CurrentValue

   oContext = CreateUnoService("com.sun.star.sdb.DatabaseContext") 
   oFont = oContext.getRegisteredObject("you database") 
   dbForms = oFont.DatabaseDocument.ReportDocuments 
   oAConnection = oFont.getConnection("","") 
'this line rewrite the Queries' 
	oAConnection.queries.getByName("queries").Command = "SELECT ""queriesID""  Where ""queriesID"" = '"& Form_id &"'"

   Dim pProp(1) As New com.sun.star.beans.PropertyValue 
   pProp(0).Name = "ActiveConnection" 
   pProp(0).Value = oAConnection 
   pProp(1).Name = "OpenMode" 
   pProp(1).Value = "open" 

   oForm = dbForms.loadComponentFromURL(FormName, "_blank", 0, pProp()) 
End Sub

@Kridtbandit the first line of openForm makes no sense. There is no such property MainForm under ThisComponent.Drawpage.forms. It must be something specific to your form. Also, what is oAConnection.queries statement? Why another query when there is one already? Sorry but this routine is not making sense. It almost appears you have a form with a list of reports and are selecting one to be run.

After some analysis I got it to work. First line of openForm (Form_ID = ...) is specific to what you are doing and it is totally not needed. Also not needed is oAConnection.queries... line. again something specific to you. With those two lines removed the routine works to run a report from a standalone form. In future eliminate or explain specifics to what code actually does. Otherwise, it’s a nice item for the toolbox.

Hello,
I tried the procedure by installing the extension.
With OpenOffice 4.1.6 Windows 10 works well.
With LibreOffice 6.2.3 Windows 10 does not work.
When starting the macro libreoffice returns an error in line 156. Error: “Value or data type not allowed. Data types not matched”.
I work with LibreOffice and if the error could be solved, it would be great. Thanks and sorry for my English.

@picozzo This is not an answer. Should only be used to respond to original question. Instead use add a comment

Got Mint version to work by replacing all occurrences of #FileNum with FileNum (remove #)

Sorry for the mistake.
Thanks for the support, the macro now it works.

By performing this procedure, LibreOffice returns an error.
“”"""
Next you need to connect the push button on the standalone form to the newly created item. In my case it was similar to /home/MY_DIRECTORY/Desktop/ReportTest.bash This was inserted into the URL property on the push button. Tested the button and the report ran fine. “”"""""""""

I translate the error: “file: // c: /Users…/ShortcutToPrintReport.bat” is not an absolute URL that you can switch to an external application for opening.

Where am I wrong? Thanks