Simplifying the upload of a data file to a Wdata Table is a core skill in streamlining Table Management. In this Connected Learning Path, we will walk through how to upload data to a Wdata Table using Chains.
| Primary Business Use Case | Table Management |
| Primary Learning Objective | Uploading Data from a Wdata Table using Chains |
| Prerequisites |
Configure Workiva Connector Configure HTTP Requestor Connector |
| Supporting Template | CLP | Upload Data from a Table |
Step 1: Create a Table
- Navigate to Wdata
- Complete the steps to create a Table with the following properties:
- Table Name: "CLP Employee Detail"
-
Columns:
Display Name Column ID Type Import Format emp_idemp_idText user_nameuser_nameText first_namefirst_nameText last_namelast_nameText job_titlejob_titleText departmentdepartmentText citycityText countrycountryText currencycurrencyText hire_datehire_dateDate M/d/yyy ftefteDecimal 1,000.00 termedtermedBoolean
Notes:
- Notice that the import format of the
hire_datevalues is being changed. This is so that it matches the format of the data that will be loaded into the table. You can find information about date/time formats on this page. - Record the table's Table ID, as this will be used later in this procedure.
Step 2: Create a Chain
- Navigate to Chain Builder.
- Add a new Chain.
- Name the Chain: CLP | Upload Data to a Table.
- Save the Chain.
Step 3: Runtime Inputs
Use the Runtime Inputs Chain Event to kick off the Chain. This allows us to specify the file name and the ID of the Table that the file will be imported to when we run the Chain. Read more about Runtime Inputs.
- Add a Runtime Inputs Chain Event from Chain Trigger Events to the Start Node.
- Edit the Runtime Inputs Chain Event by double-clicking on the Command.
- Add the values for your Runtime Inputs.
These will be text fields, and should be marked as "Required".-
Table ID - ID of the "CLP Employee Detail" table.
Check out this document for help finding the ID. -
File Name - any name you would like to call the file.
For this example, call the file "Employee Detail".
-
Table ID - ID of the "CLP Employee Detail" table.
-
File Location - Where the CSV file is located.
For this example, use:https://cs-sftp-training-bucket.s3.amazonaws.com/cs-training/transformation-qs/employee_detail.csv
- Add the values for your Runtime Inputs.
- Click Save to save the Command.
Step 4: Download File
The HTTP Request Get Command will be used to download the file that will be uploaded to the table. We have hosted a file online for the Chain to download to demonstrate downloading files from the cloud.
- Add a Get Command from the HTTP Request connector to the Chain canvas.
- Connect the Runtime Inputs Chain Event to the Get Command.
- Double-click the Command to configure it.
- Click the URL field.
- Within the left Select a Variable panel, click the down arrow to expand Trigger.
- Click the down arrow to expand Runtime Inputs.
- Select File Location.
- In the Content type field select: application/csv.
- Click the URL field.
- Save the Command.
Step 5: 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 Trigger.
- Click the down arrow to expand Runtime Inputs.
- Select Table ID.
- Click on the File field.
- Within the left Select a Variable panel, click the down arrow to expand GET.
- Select Response.
- Click on the Name field.
- Within the left Select a Variable panel, click the down arrow to expand Trigger.
- Click the down arrow to expand Runtime Inputs.
- Select File Name.
- Within the left Select a Variable panel, click the down arrow to expand Runtime.
- Select Chain.ExecutionDateTime.
- Type ".csv" after your two variables.
- Click on the Table ID field.
- Save the Command
Step 6: 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 Trigger.
- Click the down arrow to expand Runtime Inputs.
- Select Table ID.
- Click on the File ID field.
- Within the left Select a Variable panel, click the down arrow to expand Create File.
- Select Result.
- Click on Create File - Result to transform it.
- In the Select Transformation dropdown, select Get Value from JSON.
- Click the + button.
- In the Value field, type "id" and click Enter on your keyboard.
- Click ACCEPT.
- Click on the Table ID field.
- Save the Command.
Step 7: Test the Exercise
Now that the Chain is complete, let's test the result.
- Publish the Chain.
- Click Execute, and then select Run With Inputs.
- Enter the values for your Runtime Inputs.
-
Table ID - ID of the "CLP Employee Detail" table.
Check out this document for help finding the ID. -
File Name - any name you would like to call the file.
For this example, call the file "Employee Detail". -
File Location - Where the CSV file is located.
For this example, use:https://cs-sftp-training-bucket.s3.amazonaws.com/cs-training/transformation-qs/employee_detail.csv
-
Table ID - ID of the "CLP Employee Detail" table.
- Click Start.
-
Once the Chain has completed, click the Import File into Table node to verify success.
The chain should have successfully taken the file, created a Workiva file, and imported it into your Table. You can verify the data was uploaded into your table by navigating to the Table in Wdata and reviewing the dataset in the right-hand panel.
To learn more about managing datasets in Wdata Tables using Chains, check out the next path: Deleting Data from a Table!