The Size operator counts the number of values in a string, but it can also count the number of elements in an array. In this how-to guide, you’ll learn how to use a Size operator and count the number of rows in a data table.
You’ll find the Size operator under the Array operators group to the left of the Data Workflow canvas.
Finding the Size of an Array
In this example, you’ll use a Size operator and count the number of rows in a data table.
These instructions assume you have a new module open, saved, and with a title.
Configure the Data Table Component
Begin by adding a Data Table component with a list of dogs’ names and ages.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Property ID field, enter
dtDogs.In the data table, enter the following:
#
A
B
1
name
age
2
Ivy
7
3
Lucy
10
4
Wally
1
5
Nacho
5
6
Thor
5
7
Holly
13
.png)
Click Save Component.
Configure the Text Field Component
Next, configure a Text Field component to store the output from your Data Workflow. This Text Field component displays the number of rows in your array. To prevent end-users from making changes to the field, you’ll enable the Disable User Input setting in the component.
Drag and drop a Text Field component onto your canvas, placing it below your
dtDogsData Table component.In the Property ID field, enter
numberOfRows.In the Label Text field, enter
Number of Data Table Rows.From the Input Behavior drop-down, select Disable User Input.
.png)
Click Save Component.
Configure the Data Workflow Component
Lastly, configure your Data Workflow component, starting with an Input operator to bring data from your table into the Data Workflow. Then, add a Size operator to locate the number of rows the table stores. Then, output the result to your Text Field component.
Drag and drop a Data Workflow component onto your canvas, placing it below your
numberOfRowsText Field component.In the Property ID and Canvas Label Text fields, enter
dwfSize.From the Trigger Type drop-down, select Watch.
Configure the Input Operator
Drag and drop an Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Input
Component
dtDogs
Required
Yes
Source
Default
Configure the Size Operator
This operator counts the number of rows in your data table.
Drag and drop a Size operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Size
Label
Size of Data Table
Connect the output port (right) of the
dtDogsInput operator to the input port (left) of theSize of Data TableSize operator.
Configure the Output Operator
This operator sends the Size operator's value to your Text Field component.
Drag and drop an Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Output
Component
numberOfRows
Action
value
Connect the output port (right) of the
Size of Data TableSize operator to the input port (left) of thenumberOfRowsOutput operator..png)
Click Save Component.
Save your module.
Here's how your module looks in the Module Builder:
.png)
Preview your module in Express View, and you’ll see your Text Field component display the number of rows in your table. Return to your Data Table component in the Module Builder and adjust the number of rows to see new results in Express View.
.png)
The Size operator counts the number of values in a string, but it can also count the number of elements in an array. In this how-to guide, you’ll learn how to use a Size operator and count the number of rows in a data table.
You’ll find the Size operator under the Array operators group to the left of the Data Workflow canvas.
Finding the Size of an Array
In this example, you’ll use a Size operator and count the number of rows in a data table.
These instructions assume you have a new module open, saved, and with a title.
Configure the Data Table Component
Begin by adding a Data Table component with a list of dogs’ names and ages.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Label and Property Name fields, enter
dtDogs.In the data table, enter the following:
#
A
B
1
name
age
2
Ivy
7
3
Lucy
10
4
Wally
1
5
Nacho
5
6
Thor
5
7
Holly
13
.jpg)
Click Save.
Configure the Text Field Component
Next, configure a Text Field component to store the output from your Data Workflow. This Text Field component displays the number of rows in your array. To prevent end-users from making changes to the field, you’ll enable the Disable User Input setting in the component.
Drag and drop a Text Field component onto your canvas, placing it below your
dtDogsData Table component.In the Property ID field, enter
numberOfRows.In the Label Text field, enter
Number of Data Table Rows.Set Disable User Input to
(ON)..png)
Click Save & Close.
Configure the Data Workflow Component
Lastly, configure your Data Workflow component, starting with an Input operator to bring data from your table into the Data Workflow. Then, add a Size operator to locate the number of rows the table stores. Then, output the result to your Text Field component.
Drag and drop a Data Workflow component onto your canvas, placing it below your
numberOfRowsText Field component.In the Canvas Label Text and Property Name fields, enter
dwfSize.From the Trigger Type drop-down, select Watch.
Configure the Input Operator
Drag and drop an Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Input
Component
dtDogs
Required
Yes
Source
Default
Configure the Size Operator
This operator counts the number of rows in your data table.
Drag and drop a Size operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Size
Label
Size of Data Table
Connect the output port (right) of the
dtDogsInput operator to the input port (left) of theSize of Data TableSize operator.
Configure the Output Operator
This operator sends the Size operator's value to your Text Field component.
Drag and drop an Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Output
Component
characters
Action
value
Connect the output port (right) of the
Size of Data TableSize operator to the input port (left) of thenumberOfRowsOutput operator..png)
Click Save.
Save your module.
Here's how your module looks in the Module Builder:
.png)
Preview your module in Express View, and you’ll see your Text Field component display the number of rows in your table. Return to your Data Table component in the Module Builder and adjust the number of rows to see new results in Express View.
.png)