Size Operator

Estimated Reading Time:  3 minutes

Overview

The Size operator performs one of two functions in a Data Workflow:

  • Return the number of characters in a string.

  • Return the number of elements in an array.

What You'll Learn

In this article, you'll learn:

Info Window Settings

Here's what a Size 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.

Adding and Configuring a Size Operator

To show the Size operator in action, let's look at an example that uses a Data Workflow to return the number of characters in a string. This example uses a Text Field to collect your end-user's name. Then, a Data Workflow returns the number of characters in their entry.

Here's how the completed use case looks in the Module Builder:

Here's how the completed use case works in Express View:

What You Need

To set up this use case, you need:

  • 2 Text Field components

  • 1 Data Workflow component

To set up your Data Workflow, you need:

  • 1 Input operator

  • 1 Size operator

  • 1 Output operator

Configure the Text Field Components

First, add your Text Field components. Your first Text Field is an input field for your end-user. And the second Text Field shows the result of your Data Workflow. So, set this second Text Field to disable user input so your end-user can't type in it.

1. Drag and drop 2 Text Field components onto your canvas.
2. Enter the following Property IDs and Label Text fields:

Property ID

Label Text

name

Name

characters

Number of Characters

3. In your characters component, set the Disable User Input toggle to ON.

4. Save each component as you add it.

Configure the Data Workflow Component

Next, add your Data Workflow component, bringing data from your Name field into the Data Workflow using an Input operator. Then, add a Size operator to find the number of characters in the Name field. And finally, send the result to your Number of Characters field using an Output operator.

1. Drag and drop a Data Workflow component onto your canvas. Place your Data Workflow below your Text Fields.
2. Enter dwfSize in the Canvas Label Text and Property Name fields.
3. Select Watch from the Trigger Type drop-down.

Configure the Input Operator

This operator references data in your Text Field.

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

name

Required

Yes

Source

Default

Configure the Size Operator

This operator finds the number of characters present in your Text Field.

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

Setting

Value

Category

Size

Label

Number of Characters

3. Connect the output port (right) of the Input operator to the input port (left) of the Size operator.

Configure the Output Operator

This operator sends the Size operator's value to your second Text Field.

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

characters

Action

value

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

Once you complete these steps, preview your module in Express View. While you type a name in your first Text Field, the number of characters automatically updates.

Changing a Size 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 Size 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.

TIP  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.

TIP  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 Size 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.

NOTE  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/5f6b9ed7f1a98d024e95f4c9/edit.