Custom report name pattern question

Hi,

I used this workaround :
Custom definition field defines custom content for template file, not for output name pattern. You could create Groovy dataset in Root report band and place script there.
Unfortunately, only the first parameter is processed in output name pattern. You could also work around this problem forming parameter for output name pattern pattern in the dataset. For example, create report band with name Title and create Groovy dataset for that report with script like following:

Copy

return [['titleParam' : (params['idNumber'] + '_' + params['FirstName'] + '_' + params['CurrentDate'])]]

Then you could get result of the script by name ${Title.titleParam} in your output name pattern.

Regards,
Sergey

This is my script :
return [[‘titleParam’ : (params[‘PayrollItem.werknemers.roepnaam’] + ‘’ + params[‘PayrollItem.werknemers.achternaam’] + '’ + params[‘PayrollItem.loonronde.maand’])]]

But the output name returns : null_null_null.docx.

Can someone please help?

regards,
LS

Hi.

Here is an example how it could be implemented with simple entity with name and year fields:

  1. Create new band ‘Title’:
    image
  2. Set Dataset type Groovy and any dataset name
  3. Set script in the script area:
    return [['titleParam' : (params.entity.name + '_' + params.entity.year)]]
    
  4. Open Templates tab and edit your template output name pattern:
    image
  5. Save report and run.

It works for me:
image

Regards,
Nadezhda.

2 Likes

Thanks Nadezhda.

I found out where my mistake was.
This is my code, which now works fine:
return [[‘titleParam’ : ‘Loonstrook van ‘+ (params.entity).werknemers.roepnaam +’ ’ +(params.entity).werknemers.achternaam+’ ‘+(params.entity).loonronde.maand+’ '+(params.entity).jaar.jaar]]

Regards,

Lloyd