JMIX JasperReport template

Hi, I am using Reports add-on and my template is in jrxml format, using JasperSoft 6.2.0
I created a ‘reportSummary’ band, with this jpql script:

SELECT e.einvoiceType AS einvoice_type,
       e.trxNo AS trx_no,
       e.trxDate AS trx_date,
       e.einvoiceDate AS einvoice_date,
       CASE
         WHEN c.name <> b.name THEN b.name
         ELSE s.name
       END AS supplierBuyer,
       e.erpCurrencyCode AS erp_currency_code,
       e.currencyExchangeRate AS currency_exchange_rate,
       (e.totalIncludeTax + e.roundingAmt) AS totalFXTrxAmt,
       (e.totalIncludeTax + e.roundingAmt) * e.currencyExchangeRate AS totalDOMTrxAmt,
       e.internalStatus AS internal_status,
       e.myinvStatus AS myinv_status,
       e.uuid AS invoiceUuid,
       e.validatedDatetime AS validated_datetime,
       e.rejectDatetime AS reject_datetime,
       e.cancelDatetime AS cancel_datetime,
       e.direction AS direction
FROM TrxHead e
JOIN Company c ON c.co = ${co}
JOIN TrxSupplier s ON s.id = e.id
JOIN TrxBuyer b ON b.id = e.id
WHERE
  (${direction} IS NULL OR e.direction = ${direction})
  AND (${einvoiceType} IS NULL OR e.einvoiceType = ${einvoiceType})
  AND (${internalStatus} IS NULL OR e.internalStatus = ${internalStatus})
  AND (${myinvStatus} IS NULL OR e.myinvStatus = ${myinvStatus})
  AND (${erpTrxDateFrom} IS NULL OR e.trxDate >= ${erpTrxDateFrom})
  AND (${erpTrxDateTo} IS NULL OR e.trxDate <= ${erpTrxDateTo})
  AND (${eInvoiceDateFrom} IS NULL OR e.einvoiceDate >= ${eInvoiceDateFrom})
  AND (${eInvoiceDateTo} IS NULL OR e.einvoiceDate <= ${eInvoiceDateTo})
  AND (${rejectRequestDateFrom} IS NULL OR e.rejectDatetime >= ${rejectRequestDateFrom})
  AND (${rejectRequestDateTo} IS NULL OR e.rejectDatetime <= ${rejectRequestDateTo})
  AND (${cancelRequestDateFrom} IS NULL OR e.cancelDatetime >= ${cancelRequestDateFrom})
  AND (${cancelRequestDateTo} IS NULL OR e.cancelDatetime <= ${cancelRequestDateTo})

Then i uploaded my jrxml file into the template,but i get a blank pdf as the report. The jrxml and the report is uploaded here. Can someone help me, why does this happen? Thank you.

Best regards,
Amirul

Hi @amirulmukminin

Did you execute this SQL statement and did you get any records ?
To be sure, that all these ${var} are filled correctly, you should check in the logs.

Regards
Felix

Thank you for the reply.

Yes I did execute the SQL statement and I get some records from the query.

The logs are as follows:

2024-08-02T09:46:30.086+08:00  INFO 14908 --- [nio-8080-exec-3] i.j.r.libintegration.JmixReporting       : Started report [Transaction Report] with parameters [
cancelRequestDateTo:null
myinvStatus:null
erpTrxDateTo:null
cancelRequestDateFrom:null
internalStatus:null
rejectRequestDateTo:null
einvoiceType:null
eInvoiceDateTo:null
companyEntity:com.atgnexus.einvoice.entity.Company-01 [detached]
eInvoiceDateFrom:null
company:01
erpTrxDateFrom:null
rejectRequestDateFrom:null
direction:null]
2024-08-02T09:46:33.919+08:00  INFO 14908 --- [nio-8080-exec-3] i.j.r.libintegration.JmixReporting       : Finished report [Transaction Report] with parameters [
cancelRequestDateTo:null
myinvStatus:null
erpTrxDateTo:null
cancelRequestDateFrom:null
internalStatus:null
rejectRequestDateTo:null
einvoiceType:null
eInvoiceDateTo:null
companyEntity:com.atgnexus.einvoice.entity.Company-01 [detached]
eInvoiceDateFrom:null
company:01
erpTrxDateFrom:null
rejectRequestDateFrom:null
direction:null]

The null parameters are correct, only the company and companyEntity are required.
I updated the drive with a sample sql file which can be run to create dummy tables and data.

Best regards,
Amirul Mukminin

Update:

I tried using Groovy dataset (I used a different band named groovyReportSummary)

import com.atgnexus.einvoice.entity.TrxHead;

def result = []

def list = dataManager.loadValue("select CASE WHEN c.name <> b.name THEN b.name ELSE s.name END AS supplierBuyer from TrxHead e JOIN Company c ON c.co = :co JOIN TrxSupplier s ON s.id = e.id JOIN TrxBuyer b ON b.id = e.id", TrxHead.class).parameter("co", params['company']).list()

list.each(e->{
    result.add(['supplierBuyer': e.supplierBuyer])
})
return result

in the jrxml i added

<subDataset name="groovyReportSummary" uuid="34f2f4e8-f623-4023-b552-8b3df93b601a">
		<field name="supplierBuyer" class="java.lang.String"/>
	</subDataset>

I get this error

ReportingException: An error occurred while loading data for band [groovyReportSummary] and query [dataSet1]. Report name [Transaction Report]
An error occurred while loading data for data set [dataSet1]
Could not compile static script
No such property: supplierBuyer for class: java.lang.String