Using Studio you can easily manipulate specific files of an entity record. These activities allow you to execute operations such as upload, download, or delete specified files of a specified field of an entity record.
The following example demonstrates how to automatically download from Data Service a specified file containing information from the Olympics games extracted from Wikipedia pages in order to use it for other operations.
Following the steps detailed on the Creating an Entity page, we created an entity for storing information about the Olympic games.
The Olympics entity has the following fields: Name (text) and Logo (file).
Check out the following pages:
- the Upload File activity as it contains details about how to use this activity to easily upload the logos;
- the File page as it provides details on how to upload logos from the platform.
System built-in fields are automatically added to your entity in order to provide details about its creation.
We use the Query Entity Records activity to pull up a list of records from the Olympics entity from Data Service by setting up the
folder variable. This goes through all records from the Name field and outputs them in the
olympicsRecords variable to be used in the following Input Dialog activity.
Add the Input Dialog activity to display a dialog box containing the
Select label message and a
Multiple choice Input Type. In the Input array add the
olympicsRecords variable created previously for the Query Entity Records activity for which you'll apply the following function:
olympicsRecords.Select(Function (o as Olympics) o.Name).ToArray to set up the array of options to choose from.
Set up the
selectedOlympics variable to gather the output results.
Use the Assign activity to assign the
olympicsRecords.First(Function (o as Olympics) o.Name = selectedOlympics) variable created previously in the Input Dialogue activity to the new
Add the Select Folder variable to open a dialog box and create the
folder variable for the output folder path. You'll use this variable in the following Download File from Record Field activity.
Use the Download File from Record Field activity to download the
folder file from the Logo file of the
olympicEdition.Id entity record.
Add the Invoke Power Shell activity to execute the following command line:
Path.Combine(folder, olympicEdition.Logo.Name) in order to combine the following input parameters:
olympicEditionvariables and the Logo and Name fields created within the Olympics entity.
The purpose of this activity is to invoke the full path of the file and open it in the default photo viewer or editor.
As an optional step, we've added an example of how to perform a file deletion which has been commented out to not delete the file at runtime. To do this we added the Comment Out activity. Here we included the following activities that won't be executed at runtime:
Please note that you can uncomment it to try it out.
- Set up the child activities order.
We added a Sequence activity that we've renamed Ignored Activities.
- Here include the Delete File from Record Field activity to remove the file from the specified entity record field.
- For the Delete File from Record Field activity to work as expected set it up as follows:
- Set the Record ID to the
olympicEdition.Idvariable created within the Download File from Record Field activity.
- The Field from where you want to delete the file is the Logo file created in the Data Service record created at the beginning of this example.
- The Output Record is the
olympicEditionvariable created within the Assign activity.
- Set the Record ID to the
Once finished, your project should look like this:
Updated 29 days ago