Have you watched the Chains Foundations Webinar? Want to follow along at your own pace? In this Connected Learning Path, we will create a Chain that downloads data from a source, uploads to a Wdata Table, and refreshes connections, following along with the steps taken during the Chains Foundations Webinar.
| Primary Business Use Case | Automating reporting workflows |
| Primary Learning Objective | Learn foundational Chains concepts |
| Prerequisites |
Complete the following: |
| Supporting Template | CLP | Chains Foundations |
Step 1: Create a Chain
To automate moving our source data to our end reports, we first need to create a Chain that will orchestrate the process from start to finish. Since we'll always use the same Spreadsheet and Table, we'll set up Chain Variables to store these details for consistent access.
- Create a new Chain, and name the Chain: CLP | Chains Foundations.
-
Under Chain Variables, click the plus sign twice to create two Chain Variables and configure them as described below:
Variable 1:
- Type: Chain Variable (cv)
- Name: cv-Spreadsheet ID
- Value:The ID of the CLP Company Spend by Department Spreadsheet that was created in the Wdata Foundations CLP.
- To find the Spreadsheet ID:
- Navigate to the CLP Company Spend by Department Spreadsheet.
- In the URL, select the Spreadsheet ID, which is found after "
spreadsheet/" and before "/sheet".
For example, the Spreadsheet ID is shown in bold here: app.wdesk.com/a/QWNjb3VudB8yMDkwNzExMDQ0/spreadsheet/6c4a23966c3c4a10a3178ae5791db7fd/-1/sheet/3161ee0402ec4b9fa4e937e6f0f63b13
Variable 2:
- Type: Chain Variable (cv)
- Name: cv-Table ID
- Value: input the ID of the CLP Company Spend Table.
- To find the Table ID:
- Navigate to the CLP Company Spend Table.
- In the URL, select the Table ID, which is found after "
table/".
For example, the Table ID is shown in bold here: app.wdesk.com/s/wdata/a/QWNjb3VudB8yMDkwNzExMDQ0/tables/16aba1634ead43a29df8f839422582f0
- Save the Chain.
Step 2: Download File
The HTTP Request Get command will be used to download the file that will be uploaded to the table. We have hosted files online for the Chain to download to demonstrate downloading files from the cloud. To make this process dynamic, we will add the current period to the URL, which corresponds to the month we are in and will ensure we are pulling the current data set.
- Add a Get command from the HTTP Request connector to the start area.
- Double click the command to configure it.
- Populate the URL field with the content below, using a variable to generate the current month, which corresponds to the period:
https://cs-sftp-training-bucket.s3.amazonaws.com/cs-training/Webinars/ERP-P <System.DateTime>.csv. - Replace <System.DateTime> with the Runtime Variable for System Date and Time.
- Within the Select a Variable panel, click the down arrow to expand Runtime.
- Select System.DateTime.
- Click on the System.DateTime variable to transform it. Use the following values:
- For Select Transformation:, select Parse Date/Time.
- Click the + button.
- For Format dropdown:, select ISO Extended (Platform Standard).
- For Output date format:, select %m.
This output means we will only be provided with the two digit month from the system date and time.
Learn more about common date and time transformations here. - In the Input date timezone field and Output date timezone field, select your current timezone.
- Click ACCEPT.
- Populate the URL field with the content below, using a variable to generate the current month, which corresponds to the period:
- Update the Content type field to: application/csv.
- Save the command.
Step 3: Create File
Uploading a file to a Wdata table is a two-step process. The file will first need to be created in the Staged status before it can be imported for final use. We will use the Create File command to create the file within the Wdata Table in the Staged status, indicating it has been created but not yet imported as a dataset.
- Add a Create File command from the Workiva Connector to the Chain canvas.
- Connect the Get command to the Create File command.
- Double click the command to configure it.
- Click on the Table ID field.
- Within the left Select a Variable panel, click the down arrow to expand Chain.
- Select cv-Table ID.
- Click on the File field.
- Within the left Select a Variable panel, click the down arrow to expand GET.
- Select Response.
- Populate the Name field with the information below, following the same steps as before to populate the Period in the name field:
ERPSpendData<System.DateTime>.csv - Replace <System.DateTime> with the Runtime Variable for System Date and Time.
- Within the left Select a Variable panel, click the down arrow to expand Runtime.
- Select System.DateTime.
- Click on the System.DateTime variable to transform it.
- For Select Transformation, select Parse Date/Time.
- Click the + button.
- For Format, select ISO Extended (Platform Standard).
- For Output date format, select %m-%d-%Y@T%H:%M.
This output means we will only be provided with the full date and time of when the Chain is run.
Learn more about common date and time transformations here. - In the Input date timezone field and Output date timezone field, select your current timezone.
- Click ACCEPT.
- Click on the Table ID field.
- Click Save to save the command.
Step 4: Import File to Table
The second step in the process to uploading files to Wdata tables is to import the data, making it usable in Queries. This step takes the staged file and imports it into the designated Table as a dataset.
- Add an Import File into Table command from the Workiva Connector to the Chain canvas.
- Connect the Create File command to the Import File into Table command.
- Double-click the command to configure it.
- Click on the Table ID field.
- Within the left Select a Variable panel, click the down arrow to expand Chain.
- Select cv-Table ID.
- Click on the File ID field.
- Within the left Select a Variable panel, click the down arrow to expand Create File.
- Click the down arrow to expand Result.
- Select Id.
- Save the command.
Step 5: List Connections
We will use the List Connections command to retrieve the list of Connection IDs associated to the Spreadsheet ID. The List Connections command output will be a JSON file consisting of each Connection in the Spreadsheet with details relating to the Connection, including the Connection ID.
- Add a List Connections command from the Workiva Connector to the Chain canvas.
- Connect the Import File to Table command to the List Connections command.
- Double-click the command to configure it.
- Destination Type: Spreadsheet
- Destination ID: Use the Spreadsheet ID Chain variable
- Click on the Destination ID field.
- In the left variables panel, expand the Chain dropdown.
- Select the Spreadsheet ID variable.
- Save the command.
Step 6: Command Group
We will use a Command Group to enable iteration over each Connection. The Group Iterator will push each Connection on the Spreadsheet through the following steps, one by one.
- Add a Command Group to the Chain canvas.
- Connect the List Connections command to the In section of the Command Group.
- Double-click the command to configure it.
- Name the Group: Connections Iteration
- Navigate to the Iterators tab.
- Enable the Iterations toggle and click on the Iterations field.
- Within the Select a Variable panel, click the down arrow to expand List Connections.
- Select the Connections output.
- Save the Command Group.
Step 7: Refresh Connection
We will use the Refresh Connection command to refresh our Connections using the Connection ID from the iteration.
- Add a Refresh Connection command from the Workiva Connector to the Chain canvas.
- Connect the Start section from the Group Iterator to the Refresh Connection command.
- Double-click the command to configure it.
- For Connection ID: use the Connection ID from the Group iterator - Connections Iteration. This allows us to push the ID for the current iteration through to the Refresh Connections command
- Click on the Connection ID field.
- In the left panel, expand the Group Iterator dropdown.
- Expand the Connections Iteration dropdown.
- Select the ConnectionId variable.
- Check the Use Previous Source Parameters checkbox.
- For Connection ID: use the Connection ID from the Group iterator - Connections Iteration. This allows us to push the ID for the current iteration through to the Refresh Connections command
Step 8: Test the Exercise
Now that the Chain is complete, test the result.
- Publish the Chain.
- Click Execute and then Run Chain.
- Once the Chain has completed, navigate back to the Table and see that data has been loaded, navigate to the Spreadsheet and see that the connection has successfully refreshed.