Use a value in your data as the export file name
If you are looking to use a value in your data as the export file name, you may have looked at the Export step and realized that it does not allow you to directly select a value from your data as a filename component. However, you can actually use a workflow parameter as a filename component to achieve this.
You will have to set up your workfows in such a way to populate the workflow parameter value based on custom event data that can be based on your data (available as of v2.7.4). Here is an example of the set up:
- Create a custom event with a custom parameter for the export file name.
- Create a workflow containing the Export step. You will need to create a workflow parameter for the export file name that is Configurable on runtime, then assign this as a filename component at the Export settings. As part of this example, we will also set a default value for the export file name as MyExportFile to demonstrate that this will eventually be replaced by a value from your data.
- Create another workflow that will act as the Main workflow to fire the custom event in order to run the Export workflow. In the Main workflow, you can determine how you will be deriving the export file name from your data. In reality, you will also be doing all the pre-processing of your data in the Main workflow, for example any standardization, validation, duplicate detection. Assuming for this example, we just want to use the Source file name as the export file name, you can turn on the Source Metadata: Filename, use a Transform step with a Split function to remove the .csv extension from the filename, then use the transformed value as the Export File Name parameter value. Note that the purpose of removing the .csv extension is because the Export step will later on append the file extension again based on the type of exporter you use. Note also that the custom event parameter will only use the value from the first row of your data for the selected Metadata: Filename column.
- Create a notification based on the custom event. The notification should run the workflow containing the export step, supplying the workflow parameter value using the event data.
- Now, when you run the Main workflow, it should fire the Export event, and trigger the notification to run the Export workflow. The resulting output file name is Customer V1.csv based on the source filename rather than the default parameter value of MyExportFile.
You may have observed that we introduced the ability to use your data as parameters for the Fire Event step and not directly for the Export step. The reason is to allow for more possible use cases. Another useful example worth mentioning is where you could generate some statistics on your data in your workflow, use them as custom event parameter values and finally incorporate them into an email notification.