Ask Your Question
0

how to open Base reports based on queries in standalone

asked 2016-09-09 17:21:29 +0200

koolninja gravatar image

updated 2016-09-09 17:22:39 +0200

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.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
1

answered 2016-09-09 17:51:48 +0200

updated 2016-09-09 20:00:38 +0200

I think it is not possible. See here: https://forum.openoffice.org/en/forum....

Edit: corrected link.

If my answer helped you, vote it with ✔ and with ∧ (here on the left)

edit flag offensive delete link more

Comments

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

Ratslinger gravatar imageRatslinger ( 2016-09-09 18:26:22 +0200 )edit

@Ratslinger Thank you, I corrected the link.

charlie.it gravatar imagecharlie.it ( 2016-09-09 20:02:47 +0200 )edit
1

answered 2017-02-19 06:50:20 +0200

Kridtbandit gravatar image

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
edit flag offensive delete link more

Comments

@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.

Ratslinger gravatar imageRatslinger ( 2017-02-19 08:15:19 +0200 )edit

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.

Ratslinger gravatar imageRatslinger ( 2017-02-19 08:34:49 +0200 )edit
1

answered 2016-09-14 01:55:21 +0200

Ratslinger gravatar image

@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.

edit flag offensive delete link more

Comments

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

Kridtbandit gravatar imageKridtbandit ( 2017-02-19 08:58:38 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-09-09 17:21:29 +0200

Seen: 346 times

Last updated: Feb 19 '17