These are presented in the **Block Library**. These are used to channel conditions and commands between other types of blocks.

These are colored grey.

To lookup a block in the library, use the search bar.

The complete list of built-in blocks is presented below.

## Commands

**condDelay-**Add delay to condition after a transition from false to true before evaluating to true.

Units to use are: sec, min, hr**email**- Send an email using the configured SMTP connector.**setDelay**- Variable set with a delay. It only delays if there is a change of value on the set block. Setting same value will not make it delay. Recommend to use wait block instead for static set value.**setExternal**- Variable set from an external program.d**wait**- Pause the routine for a specific amount of time.

Units to use are: sec, min, hr, and day.

## Control Flow

**if**- If block performs boolean condition flow control between then and else.**return**- Return exits the routine and returns given expression value.

## Expression

**count**- Count number of the items which match a condition**dateTimeAdd**- Add a duration from a DateTime.- If no units are supplied, then minutes will be assumed.
**dateTimeSub -**Substract a duration from a DateTime.- If no units are supplied, then minutes will be assumed.
**gridSelectCol**- Selects the column of a grid**gridSize**- Number of rows in a grid.**leadLag -**LeadLag is used to schedule a number of units on/off. The 'units' property should be set to a bundle variable that imports the list units the command from the *unit program*. The unit program must have three variables for each unit:- unit stage number used to determine start order
- unit alarm status as true/false (anything not true is considered false)
- Variable used to command the unit; this variable must be set via 'setExternal' block in the unit program
- This block 'numOn' property is used to command all the units on or off.
- Each unit in alarm is commanded to off. Any remaining units are commanded on until we reach the desired number on (using unit num ordering).

**leadLagStageSelect**– LeadLagStageSelect.**limit**- Limit val between an inclusive min and max.**pid**- Proportional integral derivative loop.**random**- Generate a random number between min and max inclusive on every cycle.

## Language

**alarmBlock**- Generate an alarm based on a boolean variable.- .
**boolLatch -**Latch a boolean input when it transitions to true after a configurable delay period. Once latched the output remains true until the reset is triggered to true. **callRoutine**- Call a routine within the same program by name.**comment**– Comment.**exprStmt**- Statement wrapper for expression with side-effects.**reset**- Reset block computes output based on two linear equations. The input is clipped to inLo and inHi, the percentage of input along the linear segment between inLo and inHi is computed, and then that percentage is output as a Number between outLo and outHi.**return**- Return exits the routine and returns given expression value.**staging**- Compute number of stages which should be one. Delays are in seconds.**tag**- Name/value pair added to a Tags block.**tags**- Builds a dict of name/value tag pairs.**delayedOutput**- DelayedOutput - duration is in seconds.**dictGet**- Bundles variables in a dict.**jobRun**- Checks if a value is an instance of a given type.**varCapture**- Capture current variables as a dict.

## Logical

**all**- returns if all items in a collection matches a condition.**and**- Logical-and of boolean values.**any**- Returns if any item in a collection matches a condition.**cmpEq**- Equality comparison.**CmpGt -**Greater than comparison.**cmpGtEq**- Greater than or equal comparison.**cmpLt**- Less than comparison.**cmpLtEq**- Less than or equal comparison.**cmpNotEq**- Not equal comparison.**inRange**- Return if val is between an inclusive min and max.**not**- Logical not of boolean value.**or**- Logical-or of boolean values.**xor**- Logical exclusive-or of two boolean values.**isType**- Checks if a value is an instance of a given type.

## Math

**add**- Addition: '∑ vals'. Any val which doesn't evaluate to a number is ignored.

If no vals evaluate to a number then return null.**avg -**Fold vals their standard average or arithmetic mean. Any val which doesn't evaluate to a number is ignored.

If no vals evaluate to a number then return null.**div-**Multiply: 'vals₀ × vals₁ × vals₂ ...'. Any val which doesn't evaluate to a number is ignored.

If no vals evaluate to a number then return null.**isEven**- Check if a number is even whole integer.**isOdd**- Check if a number is odd whole integer.**max -**Maximum of vals. Any val which doesn't evaluate to a number is ignored.

If no vals evaluate to a number then return null.**min -**Minimum of vals. Any val which doesn't evaluate to a number is ignored.

If no vals evaluate to null.**modulo**- Modulo/remainder: 'a % b'. Return null if a or b doesn't evaluate to number.**mult -**Multiply: 'vals₀ × vals₁ × vals₂ ...'. Any val which doesn't evaluate to a number is ignored.

If no vals evaluate to a number then return null.**neg**- Negate: '-val'. Return null if val doesn't evaluate to number.**sineWave**- Generate a sine wave.**sub -**Subtract: 'a - b'. Return null if a or b doesn't evaluate to number.**threshold**-**aboveBy**- Check if the base number is above the input number by a threshold.**abs**- Return the absolute value of the number.**belowBy**- Check if the base number is below the input number by a threshold.**limit**- Limit val between an inclusive min and max.**pow**- Power a^b. Returns null if a or b does not evaluate to a number.**random**- Generate a random number between min and max inclusive on every cycle.**reset -**Reset block computes output based on two linear equations.

The input is clipped to inLo and inHi, the percentage of input along the linear segment between inLo and inHi is computed, and then that percentage is output as a Number between outLo and outHi.**within**- Verifies if the provided numbers are within an offset from the base.**sqrt**- Sqrt: '√`val`

'. Return null if`val`

does not evaluate to a number.

## Others

**invoke**-**ternary**-

## Strings

**strCapitalize**- Changes first letter of a string to upper case character.**strConcat**- String concatenation.**strContains**- Compares if a val string contains substring.**strDecapitalize**- Changes first letter of a string to lower case character.**strEndsWith**- Compares if a val string ends with substring.**strFormat**- String format - see `format()`.**strLower**- Changes all ASCII letters to lower case.**strMacro -**Str macro pattern which uses the same syntax as `disMacro` and `haystack::Etc.macro`. The macro variables are resolves against the task's variables.**strReplace**- String replace.**strSize**- Number of characters in a string.**strStartsWith**- Compares if a val string starts with substring.**strUpper**- Changes all ASCI letters to upper case.

## Time

**date**- Get the Date part of a DateTime.**dateTimeAdd**-**dateTimeSub**-**dateToNumber**- Convert a date to a number.**dateToString**- Convert a portion of a date to a string.**dtToDtAdd**- Add one dateTime to another -- returns duration (always minutes or seconds).**dtToDtSub**- Subtract one dateTime from another -- returns duration (always minutes or seconds).**now**- Get the current DateTime for this server.**siteDateTime**- Get the current dateTime for the site associated with the target.**time**- Get the Time part of a DateTime.**timeToMinutes**- Convert a Time to minutes.**timeToTimeAdd**- Add one time to another -- returns duration (always minutes).**timeToTimeSub**- Sub one time to another -- returns duration (always minutes).

## Weather

**weatherConditions**- Get the conditions from a forecast. Weather Conditions are: unknown, clear, partlyCloudy, cloudy, showers, rain, thunderstorms, ice, flurries, snow.**weatherInfo**- Get the temperature information from a forecast.**weatherSunrise**- Get the sunrise from a forecast.**weatherSunset**- Get the sunset from a forecast.

## Macros

This entry contains the created macro blocks (including Expressions)