Get Operator

Estimated Reading Time:  6 minutes

Overview

A static image displaying the Get operator and its Info Window.

You can use the Get operator to retrieve a single data point from a large data set. You can also use this operator to retrieve an entire row from a table or array. Once retrieved, you can then pass that data through your Data Workflow process.

All you'll need is a data reference key to locate the data you want. Your reference key will look slightly different depending on how much data you want:

  • [0]: This reference key points to an entire row. Using this key retrieves the entire first row of your data set.

  • [0].name: This reference key builds on the first, leading to a single value in the first row of your data set. Using this key returns only the value labeled name from that row.

NOTE  You'll notice that [1] doesn't point to the first row of your data set. Remember that arrays start at [0] when creating your reference keys.

You can also use the Get operator to reference global variables. You'll first create a global variable key and value. Then, you'll use the Get operator to reference the variable's key. This configuration works in conjunction with your Input operator. After setting the Input operator's Component setting to vars, you can use your global variable. This is a powerful feature that lets you easily reference data in all your Unqork environments.

TIP  For more information on creating global variables, view our Global Variables Administration article.

You'll find the Get operator under the Array group to the left of your Data Workflow canvas.

What You'll Learn

In this article, you'll learn what a Get operator is and how to configure it in a Data Workflow.

About the 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.

Path

This is the reference key leading to the data you want to retrieve. For example, [0] references the first row in your data set. And the key [0].name references the column labeled name in that first row. Or, you can use this field to reference a global variable key.

Adding a Get Operator

For this example, you'll create a Data Table that holds a list of countries and their capitals. Then, you'll set up a Data Workflow with two Get operators. One Get operator will retrieve an entire row of data, and the other will retrieve a single value.

What You Need

For this configuration, you’ll need:

To set up your Data Workflow, you'll need:

NOTE  These instructions assume you have a new module open, saved, and with a title.

Configure the Data Table Component

First, you'll add a Data Table component to hold some sample data.

1. In the Module Builder, drag and drop a Dropdown Component Icon Data Table component onto your canvas.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and Canvas Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. fields, enter dtCountries.
3. To the left of the component's configuration window, click Data Icon Data.
4. In the data table, enter the following:
  A B

1

country

capital

2

Afghanistan

Kabul

3

Albania

Tirana

4

Algeria

Algiers

5

Cambodia

Phnom Penh

6

Czech Republic

Prague

7

Andorra

Andorra la Vella

8

Austria

Vienna

A static image displaying the completed configuration of the Data Table component.

5. Click Save & Close.

Configure the Hidden Component

Next, add a Hidden component to store the output from the Get operator retrieving a full row of data.

1. Drag and drop a Hidden component onto your canvas, placing it below your Dropdown Component Icon Data Table component.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and Canvas Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. fields, enter firstRow.
3. Click Save & Close.

Configure the Text Field Component

Now lets configure a Text Field component to hold the output for the Get operator retrieving a single value. That way, you can display the value in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View..

1. Drag and drop a  Text Field component onto your canvas, placing it below your Hidden component.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter fifthCountry.
3. In the Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. field, enter Fifth Country.
4. Set Disable User Input to (ON).

A static image displaying the Text Field component configuration with Disable User Input set to ON.

5. Click Save & Close.

Configure the Data Workflow Component

Next, you'll add a Data Workflow component. Use an Input operator to retrieve the data from the Data Table component. Then, add two Get operators—one to retrieve the first row of your data set and one to retrieve a single cell. Lastly, you'll add two Output operators to output your results.

1. Drag and drop a Data Workflow Icon Data Workflow component onto your canvas, placing it between the Dropdown Component Icon Data Table and Hidden components.
2. In the Canvas Label Text and Property Name fields, enter dwfGet.

A static image displaying the configured operators on the Data Workflow canvas.

Configure the Input 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 Get First Row Get Operator

1. Drag and drop a  Get operator onto your Data Workflow canvas.
2. Configure the  Get operator's Info window as follows:

Setting

Value

Category

Get

Label

Get First Row

Path

[0]

3. Connect the output port (right) of the  Input operator to the input port (left) of the Get First Row  Get operator.

Configure the firstRow 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

firstRow

Action

value

3. Connect the output port (right) of the Get First Row  Get operator to the input port (left) of the firstRow  Output operator.

Configure the Get Fifth Country Get Operator

1. Drag and drop a second  Get operator onto your Data Workflow canvas.
2. Configure the  Get operator's Info window as follows:

Setting

Value

Category

Get

Label

Get Fifth Country

Path

[4].country

NOTE  Remember, [0] is the first row. So, [4] pulls the fifth row.

3. Connect the output port (right) of the  Input operator to the input port (left) of the Get Fifth Country  Get operator.

Configure the fifthCountry 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

fifthCountry

Action

value

3. Connect the output port (right) of the Get Fifth Country  Get operator to the input port (left) of the fifthCountry  Output operator.
4. Click Save.
5. Save your module.

Your completed module looks like the following:

A static image displaying the completed configuration on the Module Builder canvas.

Preview your module in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View.. You'll see the Fifth Country  Text Field populates with Czech Republic. This is the country from the fifth row of your data table, returned by your Get Fifth Country  Get operator. Open the DevTools Console and run the Angular command. Expand the data: tab to see the first row of data returned by your Get First Row  Get operator.

A static image displaying the fifth country from the country column in Express View. As well as the output data in the DevTools Console.

Resources