Pick Operator
Overview
When working with a Data Workflow, you might need to retrieve an entire column from your data set. For this, you'll use a Pick operator.
Like a Get operator, the Pick operator uses a data reference key to find specific data in a large data set. Here, though, all you'll need is the label of the column you're looking for. Let's say you have a column with the key name in your data table. You want to bring that column into your Data Workflow. To do that, you'll use a Pick operator with name as the reference key.
You'll find the Pick operator under the Table group to the left of your canvas.
What You'll Learn
In this article, you'll learn:
About the Info Window
Here's what the operator looks like, along with its Info window:
And here's a breakdown of each setting in the Info window:
Setting |
Description |
---|---|
Label |
Sets the label for your operator. The label you enter here shows beneath your operator on your Data Workflow canvas. This field is optional, but set a label if you use more than one of the same operator type. A label helps you identify your operators without opening any Info windows. |
Pick Keys |
This is the reference key leading to the data you want to retrieve. Here, you'll enter the key for the column you want your Pick operator to pull into your Data Workflow. So, if your column has the key name, you'll enter name here. If you're using another operator as an argument, enter _arg here. Keys are case sensitive and must match the capitalization of your column key. |
Adding a Pick Operator
To see a Pick operator in action, let's look at an example. You'll create a Data Table that holds a list of countries. In the Data Table, you'll include each country's capital. Then, you'll set up a Data Workflow with 2 Pick operators. Each operator will pull a separate column and put it in a Hidden component.
Here's how the completed use case will look in the Module Builder:
Here's how the completed use case will work in Express View, including a peek at the DevTools Console:
What You'll Need
To set up this use case, you’ll need:
-
1 Data Table component
-
2 Hidden components
-
1 Data Workflow component
To set up your Data Workflow, you'll need:
-
1 Input operator
-
2 Pick operators
-
2 Output operators
Configure the Data Table Component
First, you'll set up your Data Table.
1. | Drag and drop a Data Table component onto your canvas. |
2. | Enter dtCountries in the Label and Property Name. |
3. | In the Data Table, enter the following: |
A |
B |
---|---|
country |
capital |
Afghanistan |
Kabul |
Albania |
Tirana |
Algeria |
Algiers |
Cambodia |
Phnom Penh |
Czechia |
Prague |
Andorra |
Andorra la Vella |
Austria |
Vienna |
4. | Click Save. |
Configure the Hidden Components
Before you can add your Data Workflow, you'll need a place to store its outputs. You'll use 2 Hidden components for that. Each Hidden component corresponds to its own Pick operator.
1. | Drag and drop 2 Hidden components onto your canvas. Place your Hidden components below your Data Table. |
2. | Enter the following Property IDs and Label Text: |
Property ID |
Label Text |
---|---|
pickCountry |
pickCountry |
pickCapital |
pickCapital |
3. | Save each component as you add it. |
Configure the Data Workflow Component
1. | Drag and drop a Data Workflow component onto your canvas. Place your Data Workflow above your Hidden components. |
2. | Enter dwfPick in the Label and Property Name. |
Configure the Input Data Operator
1. | Drag and drop an Input operator onto your Data Workflow canvas. |
2. | Configure the Input operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Input |
Component |
dtCountries |
Required |
Yes |
Source |
Default |
Configure the First Pick Operator
1. | Drag and drop a Pick operator onto your Data Workflow canvas. |
2. | Configure the Pick operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Pick |
Label |
Pick Country |
Pick Keys |
country |
3. | Connect the output port (right) of the Input operator to the input port (left) of the Pick Country Pick operator. |
Configure the First Output Operator
1. | Drag and drop an Output operator onto your Data Workflow canvas. |
2. | Configure the Output operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Output |
Component |
pickCountry |
Action |
value |
3. | Connect the output port (right) of the Pick Country Pick operator to the input port (left) of the pickCountry Output operator. |
Configure the Second Pick Operator
1. | Drag and drop a second Pick operator onto your Data Workflow canvas. |
2. | Configure the Pick operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Pick |
Label |
Pick Capital |
Pick Keys |
capital |
3. | Connect the output port (right) of the Input operator to the input port (left) of the Pick Capital Pick operator. |
Configure the Second Output Operator
1. | Drag and drop a second Output operator onto your Data Workflow canvas. |
2. | Configure the Output operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Output |
Component |
pickCapital |
Action |
value |
3. | Connect the output port (right) of the Pick Capital Pick operator to the input port (left) of the pickCapital Output operator. |
4. | Click Save. |
5. | Save your module. |
Now it's time to test your Data Workflow! Preview your module in Express View and then open the Console. You'll see your Hidden components now hold one column each: your list of countries and your list of capitals.
Changing a Pick Operator's Settings
You can revisit and make changes to this operator.
1. | Click the Data Workflow component. |
A 5-button toolbar displays above the component on hover-over.
2. | Click the (Settings) button to open the Data Workflow canvas. |
3. | Click the operator to open its Info Window. |
4. | Make changes to the operator's settings as needed. |
5. | Click Save. |
6. | Save your module. |
Copying a Pick Operator
You can make a copy of your operator using familiar keyboard settings. You can copy and paste an exact copy of your operator, matching all settings.
1. | Hover over the Data Workflow component. |
A 5-button toolbar displays above the component on hover-over.
2. | Click the (Settings) button to open the Data Workflow canvas. |
3. | Click the operator you want to duplicate. |
4. | On your keyboard, press Command + C (Mac OS) or Ctrl + C (Windows/Linux) to copy the operator. |
You can copy more than one operator at a time. Hold Command or Ctrl on your keyboard and click all the operators you want to copy. Follow the rest of the steps as usual.
5. | On your keyboard, press Command + V (Mac OS) or Ctrl + V (Windows/Linux) to paste the copied operator(s) to the Data Workflow canvas. |
6. | Click Save. |
7. | Save your module. |
Did you know you can copy an operator and paste it into a different Data Workflow? You'll use the same steps outlined above.
Removing a Pick Operator
Lastly, you can delete this operator from your Data Workflow canvas. You can also use these same steps to delete a connection between two operators.
1. | Hover over the Data Workflow component. |
A 5-button toolbar displays above the component on hover-over.
2. | Click the (Settings) button to open the Data Workflow canvas. |
3. | Click the operator you want to delete. |
4. | On your keyboard, press Delete. |
Once you delete this operator, make sure to connect your remaining operators. If your Data Workflow path doesn't end with an Output or Console operator, your Data Workflow won't work. So, once you delete an operator, make sure to update any remaining paths to end at an Output or Console operator.
5. | Click Save. |
6. | Save your module. |
Lab
You can view this complete use case here: https://training.unqork.io/#/form/5f4fdc911959bf0217f5471b/edit.