fdomenechm
(Francesc Domènech)
1
We’ve try to use ReportOutputDocument to execute report programatically but Studio generate an error:
error: package com.haulmont.yarg.reporting does not exist
import com.haulmont.yarg.reporting.ReportOutputDocument;
In our build.gradle :
implementation(“io.jmix.reports:jmix-reports-rest-starter”)
implementation(“io.jmix.reports:jmix-reports-starter”)
implementation(“io.jmix.reports:jmix-reports-ui-starter”)
implementation(“io.jmix.rest:jmix-rest-starter”)
implementation(“com.haulmont.yarg:yarg:2.2.21”)
implementation(“com.haulmont.yarg:yarg-api:2.2.21”)
We use Jmix 1.5.4
Thnxs
fdomenechm
(Francesc Domènech)
3
Any news about that issue ?
Thanxs,
shchienko
(Nikita Schienko)
4
Hello @fdomenechm,
You don’t need to add YARG dependencies to your Jmix project. This dependency is already included in the Reports addon
You only need these dependencies:
build.gradle:
implementation 'io.jmix.reports:jmix-reports-starter'
implementation 'io.jmix.reports:jmix-reports-rest-starter'
implementation 'io.jmix.reports:jmix-reports-ui-starter'
I created a demo project with a simple example using the ReportRunner component:
UserBrowse:
@Subscribe("reportBtn")
public void onReportBtnClick(final Button.ClickEvent event) {
ReportOutputDocument document = reportRunner.byReportCode("user-list")
.run();
byte[] reportContent = document.getContent();
String reportName = document.getDocumentName();
downloader.download(reportContent, reportName);
notifications.create(Notifications.NotificationType.TRAY)
.withCaption("Report - Done!")
.show();
}
Demo project -
jmix-reports-154.zip (99.8 KB)
Regards,
Nikita
fdomenechm
(Francesc Domènech)
6
Thanks Nikita, that’s work fine.