How to append the timestamp of the moment the button is pressed to the output file name when exporting a file from the Button Group

When exporting an Excel file from the Button Group in Workshop,
I am looking for a way to append the timestamp of when the export button is ‘pressed’ to the file name. Even if I set the file name in combination with Function as shown below,
the timestamp of the last time the Workshop screen was reloaded (F5) is appended, causing a discrepancy with the time when the button was pressed.
It seems that this Function is only executed when the Workshop screen is opened or reloaded.

Is there a way to avoid this and use the timestamp of the exact moment the button is pressed in the output file name?

  • Function
export class GetCurrentTimestampInJST { 
    @Function()
        public getCurrentTimestampInJST(): string {
        let date = new Date();

        // convert to JST (UTC+9)
        date.setHours(date.getHours() + 9);

        return date.toISOString();
    }
  • Workshop variable setting for appending to the output file name (string)

image

Hello!

If you can find a way to chain events and whatever behavior does your export (action, export via button, etc) I did find a fix. When the button is clicked, trigger a refresh then trigger a recalculation of a the function backed string you are using for the date.

Nicole



Hello!

Thank you for your response! The issue has been resolved.
By setting it up so that recalculation and overlay are executed when the button is clicked, and then performing the export from the displayed overlay, I was able to set the file name with a nearly real-time timestamp.
(However, it seems difficult to achieve this with just one click.)

Go_Iw