How to set up an export file name based on a fixed or variable input

Sueann SeeSueann See Experian Super Contributor
edited May 2022 in Resources

In this article, we will be exploring a number of ways to set up an export file name.

Imagine you start with a simple workflow where you have a Source step and Export step. You want to export the source data to a csv file on the server export directory.

Use default export file name

By default, the filename consists of two filename components i.e. the constant value "export" and a timestamp based on when the workflow is executed. In addition, a file extension is added based on the selected Exporter type (.csv in this case).

Configure filename components

You can Insert or Delete filename components in order to customize the export file name. The possible values for the filename components is limited to

  • a number of system-defined variations on the format of the timestamp, or
  • any constant value that you can enter, or
  • using one or more workflow parameters

Use a workflow parameter as the export file name

When you set up the workflow parameter, you can assign a default value for the parameter. Checking on Configurable on runtime allow you to specify a different value for this parameter at run time.

In order for the export file name to be generated based on the workflow parameter, you need to assign this workflow parameter at the Export step Filename settings.

If the workflow parameter has been set up to be configurable at run time, you can replace the value at run time.

You may have observed that you do not need to decide on the workflow parameter value at design time as the value can be replaced at run time. However, this value is still somewhat a constant or fixed value that needs to be determined at run time. We will be exploring other ways in which you can populate the workflow parameter other than entering a fixed value.

Using Notification event data to populate a workflow parameter

A workflow can be run with a Notification. A Notification is a trigger that can be 'fired' when a particular system or custom Event occurs in Data Studio. Both system and custom events contain event data that can be used to populate a workflow parameter.

Using system event data to populate a workflow parameter

We will look at the Dataset loaded event as it is one of the available system events. The Dataset loaded event enables us to trigger our workflow based on when the source dataset is loaded.

If you click on Parameters at the Notification screen, you will see that you can replace the value set up for the ExportFileName parameter similar to how you could do it at the workflow run screen.

Alternatively, there is an option to Use event data. When it is checked on, you will be presented with a list of event data that you can use as your workflow parameter value instead.

Among the available options, you will find Filename and Filename (without extensions). Based on our example,

  • Filename would refer to the Source file name for the dataset being loaded i.e. Customer V1.csv
  • Filename (without extensions) would be Customer V1 where .csv extension is removed.

Note that if you are using the event data to set up the export file name parameter based on the source file name, you would probably prefer to use the Filename (without extensions). The Export step will still append the extension based on the Exporter type so you do not want to end up with something like Customer V1.csv.csv.

Using custom event data to populate a workflow parameter

In case you cannot find a suitable system event/event data to trigger your workflow, you can always set up a custom event with custom parameters that you can use as event data. This is exactly what needs to happen if you want to use a value in your data as the export file name. Refer to this article for more information.

Sign In or Register to comment.