Notifications
Clear all

[Solved] How can I exclude a column on csv generation of a report?

1 Posts
1 Users
2 Reactions
1,150 Views
0
Topic starter

I want to exclude certain column to be present visually in the user interface but excluded from the exported CSV.  How can I achieve that?

1 Answer
2
Topic starter

Via @isingh  :

 

  • If this is your own report then you can do this by adding the ReportExportListenerClass element for your report, i.e. <ReportExportListenerClass mode="CSV" labelKey="global/generateCsv">com.transcendsys.platform.web.report.AlertExportCsvResultListener</ReportExportListenerClass>

 

  • Or you can achieve this using report override, i.e. add following to your .rptoverride

<ReportEventListenerClassOverridemode="CSV" labelKey="global/generateCsv">com.transcendsys.platform.web.report.AlertExportCsvResultListener</ReportEventListenerClassOverride>

 

Override the beginTableResult and in that, remove or mark the field hidden

 

Sample code -

  @Override

  public void beginTableResult(ITableMeta tableMetaIn) throws TableResultListenerException {

    FieldDef fieldMail = FieldDefFactory.createAdHocFieldDef(AlertInboxSearchReportListener.MAIL, CoreFieldType.STRING, false);

    int columnIndexMail = tableMetaIn.getColumnIndex(fieldMail.getFieldRef());

    tableMetaIn.removeColumn(columnIndexMail);

    super.beginTableResult(tableMetaIn);

  }