I did some more testing but I do not know what I do not understand or do
wrong.
When I generate a report I select „Choose report topic: example“, enter the
name „example“ as the report name plus a description and click „send“.
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 both 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/newtest_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 ++;
return true;
However, e.g. the fetch script in the
„plugins\birt\webapp\birt\report\example.rptdesign“ file is:
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 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.