How to Export Results as TSV

Hi All!

I’m looking to add a button to my browser screens that exports part of the selected data as a TSV file, with altered column names.

e.g.

If column names are FName, MName, LName, Address1, Address2, Zip5, Zip4…

I want to be able to have the button query the back end with something like:
SELECT FName as One, MName as Two, Address1 as Three
FROM my.Table
WHERE {Filter Criteria} = {Whatever the User Inputs}

And then have the output show up as a tab-delimited flat file.

How would I go about doing this? Can I retrofit the CSV button to output TSV, or will I need to write the Java from scratch?

Thanks in advance for any and all advice here.

Hi Lucas,

What CSV button do you mean?

There is no straightforward way in the platform to export data to TSV. As for CSV, you can try to use the Reporting Add-on, or to use the standard ExcelAction output and save it as TSV manually.

Hey Olga,

When I say excel button I mean adding the Excel standard action (in button form) to one of my browser screens for the user.

TSV is the hard requirement, so I’ll need to go with that, and it will need to be automated as much as possible… If I wanted to write it from scratch, so that the application runs a “SELECT a, b, c AS” on the data source and exports as a TSV file, where would you recommend I start?

Should I create a new standard action, or begin somewhere else entirely?

Thanks,

Luke

This hard requirement can be implemented only manually. You can create a service that will select data from the datasource on demand. As for TSV output, it cannot be achieved even with Reporting add-on, so you’ll have to write your own logic using pure Java.
Standard (or any other) CUBA actions are not necessary in this case, you can just create a method to be invoked on some button click.

Understood. Thank you or the guidance!