Wanted to show hidden columns of a table in the downloaded file as well as wanted to change the name of the Downloaded file

Hi Team,

Have a requirement where in we are showing only few columns in table.. however when user downloads .. the downloaded file should contains all columns including hidden columns.. Also wanted to change the name of the dowloaded file.

Can u please help us on this.

Thanks & Regards,

Hi @Madhavi_G

Thanks for reaching out!

You can set this up by triggering a JS query that will download your table data

See below where I am running the following JS query to download the full table data to a csv called "FileName":

A few notes:

1) I am using Retool's exportData utility, which is accessible in Retool by default

2) If you want to use any custom formatting from the table, such as column mappers or sorting, you'll need to use Javascript to manipulate the table data, rather than simply referencing tableName.data.

3) While you can't trigger this Javascript from the native download table data button, you can still call this query from the table UI by using a custom button. Here's some instructions

Hope this helps! :blush:

Thanks @Tess for quick response .. it helps to some extent.. but have bit different requirement.. as per your message .. we cannot achieve this with table Download button instead we need to have custom button.. fine but i wanted to show this custom button only when there is a data in table and the query which will fill the table has got only few columns .. so i basically need to get the data from another source based on the data available in table.. is it possible with this solution..

like this.

select * from maincollection.data where id in (select id from searchButtontrigger.data)
with in utils.exportData as shown below.

utils.exportData(select * from maincollection.data where id in (select id from searchButtontrigger.data),'FileName',csv)

Any help would be greatly appreciated.

Thanks & Regards,

Hi @MadHavi_G

You can't call a select * query directly inside exportData, but you could do that query separately & then trigger the export data query on success.

Something like this:

Thanks @Tess for quick response.. it is kind of working now using transformer.. but not sure why alert is not working .. can u please check

if(SearchButtonTrigger.data.length > 0){

const now = new Date();
const month = (now.getMonth() + 1).toString().padStart(2, '0'); // add 1 to get 1-based month index, then pad with leading zero if necessary
const day = now.getDate().toString().padStart(2, '0');
const year = now.getFullYear().toString();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');

const timestamp = ${day}${month}${year}_${hours}${minutes};

const filename = SLM_SourceLibraryData_${timestamp};
utils.exportData(SearchButtonTrigger.data, filename, 'csv');
alert("No results found. Please perform search and try again");

Thanks .. it is working with Utils.ShowNotifications.