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 to a Wdata Table using Chains |
Prerequisites | |
Supporting Template | CLP | Upload Data to a Table |
Step 1: Create a Table
- Navigate to Wdata and 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_id emp_id Text user_name user_name Text first_name first_name Text last_name last_name Text job_title job_title Text department department Text city city Text country country Text currency currency Text hire_date hire_date Date M/d/yyy fte fte Decimal 1,000.00 termed termed Boolean
- Notice that we changed the import format of the hire_date column. This was updated to match the format of the data that will be loaded into the Table. Read all about date/time formats here.
- Take note of the Table’s ID, as it will be used in a future step after we generate data that will be uploaded to the Table using a Chain
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
We 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.
- Add a Runtime Inputs Chain Event from Chain Trigger Events the Start area
- This allows us to prompt the user for the Table ID where the data will be loaded, the File Name for the dataset, and the location of the file that will be downloaded
- Read more about Runtime Inputs
- Edit the Runtime Inputs Chain Event by double clicking on the Command
- Add the three Inputs below:
- Input 1:
- Type: TextField
- Display Name: Table ID
- Required: Checked
- Input 2:
- Type: TextField
- Display Name: File Name
- Required: Checked
- Input 3:
- Type: TextField
- Display Name: File Location
- Required: Checked
- Input 1:
- Add the three Inputs below:
- 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 demonstrating 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 on 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
- Update the Content type field to: application/csv
- Click on 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 hit Enter
- Click ACCEPT
- Click on the Table ID field
- Save the Command
Step 7: Test the Exercise
Now that the Chain is complete, test the result.
- Publish the Chain
- Click Execute and then select Run With Inputs
- Add values for your Runtime Inputs
- Table ID - ID of the CLP Employee Detail Table
- File Name - any name you would like to call the file, for this example, we are calling the file "Employee Detail"
- File Location - https://cs-sftp-training-bucket.s3.amazonaws.com/cs-training/transformation-qs/employee_detail.csv
- 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!