All Variables Used in Functions Must be Declared¶
What is new - 8.2¶
The behavior of automatically declaring non-declared variables as local variables prior to version 8.2 may seem convenient, but it can lead to unintended consequences. For example, if a report developer makes a typo in the name of a variable, it may go unnoticed, and the behavior of the program may change drastically. Similarly, if a developer assumes that a variable is a global variable but the engine did not execute the routine to create the global variable, it will be declared and handled as a local variable, which can cause unexpected behavior. This behavior can make debugging more difficult and time-consuming, as developers may have to spend more time searching for the source of the problem. To avoid such issues, it is recommended that developers declare their variables explicitly, either as local or global, depending on their intended use. This not only makes the code easier to understand and maintain but also reduces the risk of introducing bugs caused by unintentionally creating new variables.
This new checking option is per report and turned on for new reports. Turning this on for existing reports is advised but may change the behavior. For example, reports created before did not require declaring global variables per function, and when this flag is turned on, it is needed.