Calling a report from within a script process

133 views
Skip to first unread message

Martin Schönbeck

unread,
May 19, 2022, 5:36:59 PM5/19/22
to iDempiere
Hi,

I want to call a report from a groovy script, because I have to prepare something before calling the report.

Can anybody give me a hint, how to call a report or where to find a sample?

Regards,
Martin

Martin Schönbeck

unread,
Jul 8, 2022, 6:05:51 AM7/8/22
to iDempiere
Hi,

after a while I had to go back to this.

I found a working solution as long as there is only on print format defined. Then

  MQuery query = new MQuery (ad_table_id);
  new WReport (ad_table_id,query);

works for me. But as soon as there is more than one print format the WReport tries to open a select for the print format which than fails due to a missing parent. Because the user anyway shouldn't select a print format, I tried to deactivate all other print formats, but the WReport ignores the isActive. So I tried just to copy the necessary lines from WReport, but this fails because import org.compiere.print.ReportCtl; doesn't work.

Any hints, how to proceed?

Regards,
Martin

Carlos Antonio Ruiz Gomez

unread,
Jul 8, 2022, 7:58:34 AM7/8/22
to idem...@googlegroups.com
Martin, coming back to your original question:

> I want to call a report from a groovy script, because I have to prepare something before calling the report.

As far as I understand, you can set classname in reports to do pre-processing, for example that's how the report Aging works.

Regards,

Carlos Ruiz


El 8/7/22 a las 12:05, Martin Schönbeck escribió:
--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/291778e1-cedc-455b-8b1f-f8f740c9952en%40googlegroups.com.


Martin Schönbeck

unread,
Jul 8, 2022, 9:44:23 AM7/8/22
to iDempiere
Hi Carlos,

this works, about while preprocessing a parameter of the report later on must be set (a counter which is set by the preprocessing), so that only entries with this counter are displayed.

Is there a chance to set the report parameters from within the preprocessing?

Regards,
Martin

Martin Schönbeck

unread,
Jul 8, 2022, 4:53:52 PM7/8/22
to iDempiere
Hi Carlos,

finally I got it to work. I had to introduce a writeprotected param which I then could update within my preprocessing script via update of ad_pinstance_para. Then I got the desired report. I first tried to simply add a new parameter to ad_pinstance_para, but this is joined to ad_process_para when creating the query.

Regards,
Martin

Martin Schönbeck

unread,
Jul 8, 2022, 4:56:06 PM7/8/22
to iDempiere
Hi Carlos,

because I'm curious all the way: can you give me a hint why the
import org.compiere.print.ReportCtl;
didn't work?

Regards,
Martin

Carlos Antonio Ruiz Gomez

unread,
Jul 16, 2022, 10:46:23 AM7/16/22
to idem...@googlegroups.com
Hi Martin, I have not checked, but probably it has to do with the classpath of the ClassLoader.

The class org.compiere.print.ReportCtl is on the plugin org.adempiere.ui - could be possible that you can just reference classes from org.adempiere.base

But again, I'm just theorizing here - not checked.

Regards,

Carlos Ruiz



El 8/7/22 a las 22:56, Martin Schönbeck escribió:

Martin Schönbeck

unread,
Jul 16, 2022, 12:53:48 PM7/16/22
to iDempiere
Hi Carlos,

Carlos Antonio Ruiz Gómez schrieb am Samstag, 16. Juli 2022 um 16:46:23 UTC+2:
Hi Martin, I have not checked, but probably it has to do with the classpath of the ClassLoader.

The class org.compiere.print.ReportCtl is on the plugin org.adempiere.ui - could be possible that you can just reference classes from org.adempiere.base

That was my impression, too. That's why I switched to your proposal  to do it with preprocessing within the report.

Regards,
Martin

Flo Boj

unread,
Jul 19, 2022, 9:01:47 AM7/19/22
to iDempiere
Hi !

I encountered the same problem ( bout 1 year ago ).
This is what happened:
I just created my own "UeitReportEngine-plugin (more control, etc..)
------------------------------------------------------
this is how the classes there go :
/**
 *    @author Trifon Trifonov 
 *    @changes by Florian
 *    @version $Id$
 */
package org.ueit.UReportEngine;
public interface UEIT_I_Persistent {

    public boolean save();
   
} ... then change the objects inside code, respectivly...

------------------------------------------------------
Things like C_Order_ID :: SO_COrder_ID,PO_COrder_ID  (restrictions from  Postgres-View),
better PDF Export ( row coloring etc )  
I try to solve at the moment.
We use this plugin as our "Business Warehouse", or just "Eye", from inside every Dialogs Window Toolbarbutton 
every day infact .
------------------------------------------------------
-rw-r--r-- 1 idempiere7 idempiere7  4235 25. Okt 2021  ActionWindow.java
-rw-r--r-- 1 idempiere7 idempiere7   157 16. Jul 2021  Activator.java
-rw-r--r-- 1 idempiere7 idempiere7   505 16. Jul 2021  FieldPosition.java
-rw-r--r-- 1 idempiere7 idempiere7 21109 31. Mai 15:11 Helper.java
-rw-r--r-- 1 idempiere7 idempiere7  4083 16. Sep 2021  HtmlToExcel.java
-rw-r--r-- 1 idempiere7 idempiere7   353 16. Jul 2021  IUEITReportEngineEventListener.java
-rw-r--r-- 1 idempiere7 idempiere7  5359 16. Jul 2021  OrderWidget.java
-rw-r--r-- 1 idempiere7 idempiere7  6073  7. Jul 10:10 ReportSelector.java
-rw-r--r-- 1 idempiere7 idempiere7 45126 15. Jul 13:42 UDataEngine.java
-rw-r--r-- 1 idempiere7 idempiere7  6475 19. Jul 2021  UEITDisplayFieldsPanel.java
-rw-r--r-- 1 idempiere7 idempiere7  1814 16. Jul 2021  UEITExtendedTheme.java
-rw-r--r-- 1 idempiere7 idempiere7 11219 19. Jul 2021  UEITFieldOrderPanel.java
-rw-r--r-- 1 idempiere7 idempiere7  4564 19. Jul 2021  UEITGroupingCriteriaPanel.java
-rw-r--r-- 1 idempiere7 idempiere7 22302 12. Mai 13:04 UEITReportCustomization.java
-rw-r--r-- 1 idempiere7 idempiere7 87071  1. Jul 10:22 UEITReportEngine.java
-rw-r--r-- 1 idempiere7 idempiere7   468 16. Jul 2021  UEITReportEngineEvent.java
-rw-r--r-- 1 idempiere7 idempiere7 61147  9. Jun 12:49 UEITReportViewer.java
-rw-r--r-- 1 idempiere7 idempiere7 19025 19. Jul 2021  UEITSortCriteriaPanel.java
-rw-r--r-- 1 idempiere7 idempiere7  7434 19. Jul 2021  UEITSummaryFieldsPanel.java
-rw-r--r-- 1 idempiere7 idempiere7  2247 19. Jul 2021  UEITTabPanel.java
-rw-r--r-- 1 idempiere7 idempiere7  6152 10. Aug 2021  UEIT_I_AD_ReportView.java
-rw-r--r-- 1 idempiere7 idempiere7  2209 10. Aug 2021  UEIT_I_Persistent.java
-rw-r--r-- 1 idempiere7 idempiere7  2533 10. Aug 2021  UEIT_MReportView.java
-rw-r--r-- 1 idempiere7 idempiere7  6609 10. Aug 2021  UEIT_X_AD_ReportView.java
-rw-r--r-- 1 idempiere7 idempiere7  2716 29. Okt 2021  UReportEngine.java

------------------------------------------------------
One key improvement//feature is
a field inside Print Format called "RowColorFilter" ("Farbfilter"), to change ROW(not column!!) Colors as needed.
where the user can go like " 
##Field istfertig, Field Lieferant, Field DatePromised....
 ##First Rule matching effects row color (html background color,tho) :
istfertig=ja:hellgrün;Lieferant=R.U.I. Yellow GmbH:lila;Lieferant=S.A. Superdeliverer:orange, DatePromised <"2022-07-01":grau
"
------------------------------------------------------

Just in case someone wants to check the source, mail me.

Best Regards and Greets
Florian

Flo Boj

unread,
Jul 19, 2022, 9:08:02 AM7/19/22
to iDempiere
oh, forgot lo´:
Of course Column-sorting ( with a javascript besides ), plus sticky header, plus "jump back to pos on reenter engine")

Lots of stuff indeed.
Greets again,
Regards 
Florian

Reply all
Reply to author
Forward
0 new messages