FILL
Use the FILL function to preset or initialise all items in an Array to be the same value.
Use
FILL( value, count )
Create an array with the specified number of items, each filled with the given value.
| Parameter | Required | Description |
|---|---|---|
| value | Yes | a value of any type |
| count | Yes | the number of items to create in the array |
| Returns | Array matching the type of value |
Examples
Initializing a Variable Array for Totals
When setting up an approval, it is best practice to provide starting values for variables to avoid errors in future calculations. You can use FILL in a Variable Initialisation Formula within the Start step to prepare a data structure.
- Scenario: You need a Number Array called
$MonthlyTargetsthat holds 12 values (one for each month), all starting at a base value of 100. - Formula:
FILL(100, 12) - Logic: This creates an array with 12 items, and every single item is the number 100. This ensures that if a later step tries to perform math on any month in the array, the system finds a number instead of a blank value.
Presetting a Logical Checklist
Output Preset Formulas are used to give users a "starting value" on a form. This is particularly helpful for Teams Activity steps where you want to guide a reviewer’s input.
- Scenario: You have a Logical Array (a series of checkboxes) for a safety inspection. To encourage a "safety-first" approach, you want all 5 required checks to be marked as TRUE by default when the reviewer opens the form.
- Formula:
FILL(TRUE, 5) - Logic: The function generates an array of 5 items, each containing the logical value TRUE. When the reviewer views the activity in their Inbox, the capture widget for that array will show five pre-checked boxes.