Here is my message again, slightly extended. Yes, I need help with this.

I did some more testing but I do not know what I did not understand and do wrong.

When I generate a report I select „Choose report topic: example“, enter the name „example“ as the report name plus the description and click „send“. So I assume I selected the master "example.rptdesign" to generate my report.

This generates the file G:\ofbiz-2\runtime\uploads\birtRptDesign\example_0.rptdesign.

When open this file with the BIRT report designer or download this file and open it, the Initialize, Open and Fetch scripts are completely different from the ones in the „plugins\birt\webapp\birt\report\example.rptdesign“ file which I think is the master. I assume these files should be the same?

I get the following scripts:

Initialize:
importPackage(Packages.org.eclipse.birt.report.engine.api);
importPackage(Packages.org.apache.ofbiz.entity);
importPackage(Packages.org.apache.ofbiz.service);
importPackage(Packages.org.apache.ofbiz.base.util);
importPackage(java.util);
module = "G:/ofbiz-2/runtime/uploads/birtRptDesign/example_0.rptdesign"; Debug.logInfo("###### In initialize ", module);

Open:
importPackage(Packages.org.apache.ofbiz.birt);
Debug.logInfo("#### In open", module)
try {
listRes = dispatcher.runSync("callPerformFindFromBirt", UtilMisc.toMap("userLogin", reportContext.getParameterValue("userLogin"), "locale", reportContext.getParameterValue("locale"), "reportContext", reportContext));
   if (ServiceUtil.isError(listRes)) {
        Debug.logError(ServiceUtil.getErrorMessage(listRes));
   }
}
catch (e) { Debug.logError(e, module); }
records = listRes.get("records");
countOfRow = 0;
totalRow = records.size();

Fetch:
if (countOfRow == totalRow) return false;
line = records.get(countOfRow);
longDescription = line.get("longDescription"); row["longDescription"] = longDescription; exampleTypeId = line.get("exampleTypeId"); row["exampleTypeId"] = exampleTypeId;
anotherDate = line.get("anotherDate"); row["anotherDate"] = anotherDate;
exampleDate = line.get("exampleDate"); row["exampleDate"] = exampleDate;
exampleId = line.get("exampleId"); row["exampleId"] = exampleId;
comments = line.get("comments"); row["comments"] = comments;
statusId = line.get("statusId"); row["statusId"] = statusId;
description = line.get("description"); row["description"] = description;
anotherText = line.get("anotherText"); row["anotherText"] = anotherText;
exampleName = line.get("exampleName"); row["exampleName"] = exampleName;
exampleSize = line.get("exampleSize"); row["exampleSize"] = exampleSize;
countOfRow ++;


However, the scripts in the plugins\birt\webapp\birt\report\example.rptdesign file, which I think is the master, are:

Initialize:
importPackage(Packages.org.apache.ofbiz.base.util)
module = "example.rptdesign";

Open:
examples = null;
try {
   examples = delegator.findList("Example", null, null, null, null, false);
} catch (e) {
   Debug.logError(e, module);
}
totalRow = 0;
countOfRow = 0;
if (examples) {
   totalRow = examples.size();
}return true;

Fetch:
if (countOfRow == totalRow - 1) return false;

example = examples.get(countOfRow);
exampleId = example.getString("exampleId");
exampleTypeId = example.getString("exampleTypeId");
exampleName = example.getString("exampleName");

row["exampleId"] = exampleId;
row["exampleTypeId"] = exampleTypeId;
row["exampleName"] = exampleName;

countOfRow ++;
return true;


When I then run the report with output as html/text I get the message:
The following items have errors:

Table (id = 35):
+ DataSet "Example" is not defined in report.
+ A BIRT exception occurred. See next exception for more information.
ReferenceError: "dataSetRow" is not defined.


However, I get it to run when I copy the „plugins\birt\webapp\birt\report\example.rptdesign“ file into the „G:\ofbiz-2\runtime\uploads\birtRptDesign„ directory and rename it to „example_0.rptdesign“. Then I get the same report as the example PDF available in the „Main“ button. I can also download that and upload it again. It will work.

So it seems to me that the example_0.rptdesign file is not generated properly. At least you cannot generate a report from it without modifications which are not mentioned in the BIRT flexible reports documentation.



-----Ursprüngliche Nachricht----- From: Jacques Le Roux
Sent: Thursday, September 24, 2020 6:50 PM
To: [email protected]
Subject: Re: BIRT Flexible reports questions

Hi Georg,

Sorry, I saw your last message this morning but I lost it (issue with my machine). If needed please resend, TIA

Reply via email to