# Downloading file fields in entity records

> 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.

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](https://docs.uipath.com/activities/docs/download-file-from-record-field) from Data Fabric / Data Service a specified file containing information from the Olympics games extracted from Wikipedia pages in order to use it for other operations.

[Download example](https://documentationexamplerepo.blob.core.windows.net/examples/Data%20Service/Data%20Services_File-Example-Download.zip)

## Prerequisite: Create entities in Data Fabric / Data Service

Following the steps detailed on the [Creating an Entity](https://docs.uipath.com/data-service/automation-cloud/latest/user-guide/creating-an-entity#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](https://docs.uipath.com/activities/docs/upload-file-to-record-field) as it contains details about how to use this activity to easily upload the logos;
* the [File](https://docs.uipath.com/data-service/automation-cloud/latest/user-guide/file#file) page as it provides details on how to upload logos from the platform.
  :::note
  System built-in fields are automatically added to your entity in order to provide details about its creation.
  :::

  ![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-46972-98ab1284-65b64a20.webp)

## Step 1: Build the workflow

### Query related records

We use the **[Query Entity Records](https://docs.uipath.com/activities/docs/query-entity-records)** activity to pull up a list of records from the Olympics entity from Data Fabric / 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.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47683-66b45a0b-b1490955.webp)

### Create an input dialog box

Add the **[Input Dialog](https://docs.uipath.com/activities/docs/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.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-46960-d5c69368-0f794a57.webp)

### Assign a value to the file

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 `olympicEdition` variable.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47196-f8dccaec-8f0f0053.webp)

### Set up a select folder dialogue box

Add the **[Select Folder](https://docs.uipath.com/activities/docs/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.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47140-8dfaa18f-e714fbfa.webp)

### Download file from record field

Use the **[Download File from Record Field](https://docs.uipath.com/activities/docs/download-file-from-record-field)** activity to download the `folder` file from the **Logo** file of the `olympicEdition.Id` entity record.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47124-92efa58b-734f09fe.webp)

### Set up a power shell command

Add the **[Invoke Power Shell](https://docs.uipath.com/activities/docs/invoke-power-shell)** activity to execute the following command line: `Path.Combine(folder, olympicEdition.Logo.Name)` in order to combine the following input parameters: `folder` and `olympicEdition`variables 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.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47164-2a2a214b-257386fc.webp)

### [Optional] Comment out

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](https://docs.uipath.com/activities/docs/comment-out)** activity. Here we included the following activities that won't be executed at runtime:

Note that you can uncomment it to try it out.

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-46796-2b4a3d25-118272fa.webp)

1. Set up the child activities order.

   We added a **[Sequence](https://docs.uipath.com/activities/docs/sequence)** activity that we've renamed **Ignored Activities**.
2. Here include the **[Delete File from Record Field](https://docs.uipath.com/activities/docs/delete-file-from-record-field)** activity to remove the file from the specified entity record field.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47770-82fb2ea5-4055c8a2.webp)
3. For the **Delete File from Record Field** activity to work as expected set it up as follows:
   1. Set the **Record ID** to the `olympicEdition.Id` variable created within the **Download File from Record Field** activity.
   2. The **Field** from where you want to delete the file is the **Logo** file created in Data Fabric / Data Service record created at the beginning of this example.
   3. The **Output Record** is the `olympicEdition` variable created within the **Assign** activity.

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47216-37608f1a-e1ba2011.webp)

Once finished, your project should look like this:

![docs image](https://dev-assets.cms.uipath.com/assets/images/data-service/data-service-docs-image-47160-907db4b0-7d8cee85.webp)
