Home Search

DriveWorks Pro 22
Set Calculation Table Row Count

Send Feedback

Set Calculation Table Row Count

This Specification Flow Task will set the number of rows in a Calculation Table.

Properties

Property NameDescription
TitleChanges the Title (not the name) of the task.
Calculation Table NameThe name of the Calculation Table.
Row CountThe number of rows to set the Calculation Table to.

Row Count Delta

This connection point can be linked to another task, such as Drive Constant Value, to report the number of rows that were added or subtracted.

The value will be positive for rows added and negative for rows subtracted.

Example

When this Task is added the properties are static. To be able to build rules on a static property see How To: Change A Static Property To A Dynamic Property.

Property NameExample RuleExample ResultMeaning
Calculation Table NameMyCalculationTableMyCalculationTableWill set the row count on the Calculation Table named MyCalculationTable.
Row CountCalcTableRowsToUseReturn4Will set the row count to the value of the control CalcTableRowsToUse.

How to Use

The following shows a basic example of how this task can be used to display a set number of rows from a Calculation Table.

Example Calculation Table

The Calculation Table below (named MyCalculationTable) consists of 5 rows of data.

Column Rules have been built for each Column Value, this is so the example can display more rows than the 5 applied in the Calculation Table.

Cell rules can be used in the Calculation Table but only if you will be needing the same amount or less than the rows applied to the table.

If you do need rows adding to the table that cannot have Column Rules applied consider using the Export To Calculation Table document also.

BaseNumberMultiplierRandomValueSumColumnValue
1ExtractNumber(MyName())125Round(RandBetween(1,100),0)[3l]+[2l]+[1l]
2ExtractNumber(MyName())125Round(RandBetween(1,100),0)[3l]+[2l]+[1l]
3ExtractNumber(MyName())125Round(RandBetween(1,100),0)[3l]+[2l]+[1l]
4ExtractNumber(MyName())125Round(RandBetween(1,100),0)[3l]+[2l]+[1l]
5ExtractNumber(MyName())125Round(RandBetween(1,100),0)[3l]+[2l]+[1l]

Example Specification Macro

A Specification Macro (SetCalcRows) is required that will use the Set Calculation Table Row Count Task.

We can also drive the Row Count Delta (the number of rows subtracted or added) into a constant (DWConstantRowCountDelta) using the Drive Constant Value Task.

Add a Spin Button to a user form named CalcTableRowsToUse.

And

Create a constant named RowCountDelta.

This will enable you to complete the properties for these tasks.

Example User Form - Specification Macro Not Executed

The following controls have been added to our user form:

  • Spin Button (CalcTableRowsToUse)

    The Row Count property of the Set Calculation Table Row Count Task should be set to the return value of this control.

  • Macro Button (SetRows)

    The Macro Name property of this control should be set to the name of the Specification Macro created above (SetCalcRows).

  • Data Table (MyData)

    The Items property of this control should be set to the name of the Calculation Table created (MyCalculationTable).

  • Label (RowCountDelta)

    The Text property of this control should include the constant (DWConstantRowCountDelta) to be displayed on the user form.

When a specification is run, and before the Macro button is executed, the Data Table will display all the rows from the Calculation Table.

Example User Form - Specification Macro Executed to Set Calculation Rows to 4 (Negative Row Count Delta)

When the Spin Button is set to 4 (1 less row than in the Calculation Table), and the Macro Button is executed, the Data Table will display only the first 4 rows of the Calculation Table.

The Row Count Delta will be -1.

Example User Form - Specification Macro Executed to Set Calculation Rows to 8 (Positive Row Count Delta)

When the Spin Button is set to 8 (4 more Row than previously selected), and the Macro Button is executed, the Data Table will display 8 rows of the Calculation Table.

The Row Count Delta will be 4.

See also Delete Calculation Table Row.