In Assette, internal variables—defined at either the Global or Row scope—are automatically assigned a data type based on the selected operation and the column type. This behavior ensures that variables return consistent, predictable results without requiring manual type selection.
Automatic type assignment helps enforce alignment between the logic applied and the expected data structure, reducing errors during data processing and improving output reliability.
How Variable Types Are Determined #
When defining an internal variable, users must select both a column and an operation. Assette uses this combination to determine the resulting variable type. The table below outlines how variable types are derived:
Operation | Applicable Column Type | Resulting Internal Variable Type |
---|---|---|
Sum | Decimal, Integer, Currency | Same as selected column |
Average | Decimal, Integer, Currency | Always Decimal or Currency |
Min | Decimal, Integer, Currency | Same as selected column |
Max | Decimal, Integer, Currency | Same as selected column |
Has Any | Any type | Boolean |
Include All | Any type | Boolean |
Count | Any type | Integer |
First | Any type | Same as selected column |
List | Not applicable | Removed – no longer available |
This approach ensures that variables behave consistently with the logic and data structure they reference.
Notes on Operation Selection #
- Operations such as Sum, Min, Max, and First return the same type as the column being evaluated. This preserves the formatting and type integrity of the original data.
- The Average operation always returns a Decimal or Currency value, regardless of whether the source column is an integer. This supports proper precision in calculations.
- Logical operations such as Has Any and Include All evaluate to Boolean values.
- Count always returns an Integer, making it suitable for row or item tallies.
- The List operation has been removed and is no longer available for use when defining internal variables.
Benefits of Automatic Type Assignment #
- Streamlined setup: No manual selection of variable types is required.
- Type consistency: Variable output matches the intended logic and source data type.
- Error prevention: Minimizes mismatches between variable types and downstream usage.
- Improved clarity: The removal of unsupported operations avoids confusion during setup.
Additional Resources #
For detailed guidance on defining and using internal variables in Assette, see:
- Working with Internal Variables
- Understanding Variable Scope
- Transform Logic and Supported Operations
These resources provide comprehensive information on incorporating variable logic into your data blocks and ensuring reliable, maintainable outputs.