AX1091

Using calc method variables

You can define one or more variables for a calc method in a calc method library, so that users are prompted to specify values for the variables when using the calc method. When a user inserts the calc method into a sheet, or uses the calc method to overwrite another calc method in the sheet, Axiom first displays a dialog that prompts the user to specify values for the variables. After the user specifies the values, the insert or overwrite operation continues, and the values are placed in the appropriate cells.

For example, many calc methods require the user to specify an account code. Instead of making the user identify the appropriate cell in the sheet and then enter or select an account code after the calc method has been inserted, a calc method variable can be used to prompt the user to select the account code as part of the insertion process.

Example calc method variables in the Desktop Client

When you define a calc method variable, you specify properties such as the following:

  • The name of the variable, to be displayed on the calc method form to identify what the user is entering or selecting.
  • The type of variable—for example, whether the user is manually entering text or a number, or whether the user is selecting from a predefined list.
  • The relative location of the variable, to determine where the specified value is placed in the calc method.
  • Whether the user is required to specify a value for the variable.
  • Whether the variable only displays when the calc method is initially inserted.

All defined variables for the calc method are displayed in the same dialog. You can specify the order in which the variables are presented on the form.

Calc method variables apply when users insert or change (overwrite) calc methods in a plan file. Variables are ignored when calc methods are inserted via an Axiom query.

NOTE: The normal change rules do not apply to calc method variables. If the new calc method has a variable defined, the variable value specified by the user always overrides the existing cell contents. However, if the user does not specify a variable value (if the variable is not required and the user leaves the entry blank, or if the variable is excluded from the change operation because it is set to Insert Only), then the normal change rules apply to that cell.

If a plan file is form-enabled, then users will also be prompted to select variable values when they insert calc methods using the Add Rows command. For more information, see Inserting calc methods in an Axiom form. Axiom forms do not currently support changing calc methods on existing rows, so calc method insertion is the only opportunity for users to specify variable values in this context.

Options to define calc method variables

There are two ways to define calc method variables:

  • Using a data source in the spreadsheet (Preferred): You can define calc method variables using a CalcMethodVariables data source within a sheet of the spreadsheet. This feature takes more effort to set up, but supports more variable types and features.

  • Within the calc method properties (Legacy): You can define calc method variables directly within the calc method properties. This feature is simpler to set up, but supports fewer variable types and features.

The data source feature is the preferred approach to defining calc methods, and is intended to be the focus of any enhancements moving forward. The calc method properties feature is considered to be the legacy approach, and is supported primarily for backward-compatibility. Although there are currently no plans to remove the legacy approach, we strongly encourage adopting the new approach for any new calc methods, or as part of any significant design changes to existing calc methods.