We know that gathering data in the optimal format is essential to streamlining end to end reporting cycles. The most efficient way to gather and aggregate data in Wdata is to use Queries. In this Connected Learning Path, we will learn how to run a Wdata Query using Chains, automating data gathering.
Primary Business Use Case | Reporting on data stored in Wdata |
Primary Learning Objective | Executing a Query from a Chain |
Secondary Learning Objectives | Exporting the Query results to a Spreadsheet |
Prerequisites |
Complete the CLP | Create a Query with a Calculated Field Identify the Query ID of the CLP Employee Detail Query Optional - Identify the URL of an existing Spreadsheet to write the Query results to |
Supporting Template | CLP | Run a Query and Exporting Results |
Step 1: Create a Chain
- Add a new Chain
- Name the Chain: CLP | Run a Query and Export Results
- Save the Chain
Step 2: Runtime Inputs
We use the Runtime Inputs Chain Event to kick off the Chain. This allows us to prompt the user for the ID of the Query and for the URL of the Spreadsheet to write the results to. The Spreadsheet URL field is optional; if it's left blank, a new Spreadsheet will be created.
- Add a Runtime Inputs Chain Event from Chain Trigger Events the Start area
- This allows us to prompt the user for the Query ID of the Query and the URL of the Spreadsheet where the results will be written
- Read more about Runtime Inputs
- Edit the Runtime Inputs Chain Event by double clicking on the Command
- Add the Inputs below:
- Input 1:
- Type: TextField
- Display Name: Query ID
- Required: Checked
- Input 2:
- Type: TextField
- Display Name: Spreadsheet URL
- Required: Unchecked
- Input 1:
- Add the Inputs below:
- Save the Command
Step 3: Run Query
In order to retrieve the most recent data, the Query first needs to be run. Once the Query has successfully run, we can export the Query results to use in reporting down the line or to send to other external systems. We will use the Run Query Command to execute the Wdata Query.
- Add a Run Query Command from the Workiva Connector to the Chain canvas
- Connect the Runtime Inputs Chain Event to the Run Query Command
- Double click the Command to configure it
- Click on the Query ID field
- Within the left Variables panel, click the down arrow to expand Trigger
- Click the down arrow to expand Runtime Inputs
- Click on Query ID
- Click on the Query ID field
- Save the Command
Step 4: Export Query Results
The second step required to use our Query results is to export the data to a Spreadsheet. The Export Query Results Command is used to write the results of the Query execution to a specified Sheet within a Spreadsheet.
- Add a Export Query Results Command from the Workiva Connector to the Chain canvas
- Connect the Run Query Command to the Export Query Results Command
- Double click the Command to configure it
- Click on the Query Result ID field
- Within the left Variables panel, click the down arrow to expand Run Query
- Click the down arrow to expand Query Results
- Click on Id
- Click on the Query Result ID field
Tip! If you need to use your Query results in a subsequent Command, use the Download Query Results Command from the Workiva Connector, using the same Query ID from above as the input for the Query Result ID field.
-
- Next click on the Spreadsheet URL field
- Within the left Variables panel, click the down arrow to expand Trigger
- Click the down arrow to expand Runtime Inputs
- Click on Spreadsheet URL
- Next click on the Spreadsheet URL field
- Save the Command
Step 5: 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
- Query ID - ID of the CLP Employee Detail Query
-
Spreadsheet URL - full URL of the Spreadsheet you would like to export the Query results to
- In this example - a Spreadsheet was created in the Workiva Platform and named CLP Employee Totals
- Once the Chain has successfully completed, view the Spreadsheet to verify results
- The chain should have successfully run the Query and exported the results to the Spreadsheet
- You can verify the data was exported into your Spreadsheet by navigating to the Sheet URL
Learn more about running Queries using Chains by completing the next path: Run a Query with a Parameter!