AX1122
Using dependent calc method variables
When using a CalcMethodVariables data source to define calc method variables, you can make one variable dependent on the selected value of another variable. If the dependent variable is configured with dynamic settings—such as using formulas to determine the list or column or filter—then the dependent variable can change based on the selected value of the "parent" variable. You can also determine whether the dependent variable displays at all, by making the [IsEnabled]
property for the variable dynamic.
Dependent variables work as follows:
-
When the user specifies a value for the parent variable, that value is placed in the
[SelectedValue]
cell for that variable within the CalcMethodVariables data source, and the file is calculated. -
The settings for the dependent variable are re-read, and the Calc Method Variables dialog is updated for any changes.
-
When all variable values are selected, the calc method is inserted and variable values are placed in their designated locations within the calc method. The [SelectedValue] cell is cleared as part of this process, as it is not intended to store values for calc method variables in this location. It is a temporary location, so that dependent formulas can be calculated based on the selected value for the parent variable.
NOTE: There is a current known issue that prevents the
[SelectedValue]
column from being cleared after the insertion occurs. This issue is intended to be fixed in a later patch or release. It is not intended to persist values in the[SelectedValue]
column.
IMPORTANT: The dependent variable behavior only applies when inserting calc methods within the Desktop Client. The Web Client does not currently support dependent variables, except for purposes of configuring RelatedColumnValue variables.
Configuring a variable as dependent
If you want a variable to be dependent on another variable, set the [DependsOn]
property for the dependent variable to the name of the "parent" variable. For example, if the Account variable is dependent on the value selected for the Category variable, then enter Category
in the [DependsOn]
property for the Account variable.
Once a variable has been designated as dependent on another variable, then you can use formulas in its variable settings to dynamically change the variable based on the parent variable selection. For example, you could use formulas to:
- Specify whether the variable is enabled or not (see the visibility discussion for more information)
- Change the list choices for the variable
- Change the Table.Column for the variable
- Change the filter applied to the column
- Change the display name for the dependent variable
NOTE: The variable name must remain static because it is used to identify the variable. If you need the name of the dependent variable to change based on the selection of the parent variable, then you must make the display name dynamic instead of the name.
In all of these cases, the formula should look to the [SelectedValue]
field of the parent variable and change in response. For example, users could specify a numeric value for the parent variable, and then the dependent variable could be enabled or not depending on whether the numeric value was greater than a certain amount. Or users could select an account category from the parent variable, and then the filter for the dependent variable could change based on the parent variable selection—so that only accounts for the selected category are shown.
The calculation and update of the Calc Method Variables dialog only occurs if a variable is flagged as dependent using the [DependsOn]
property, and only dependent variables are updated. If you use formulas in variable settings but the variable is not flagged as dependent, then the variable will not update once the Calc Method Variables dialog has been presented to the user.
Using RelatedColumnValue variables
RelatedColumnValue variables can be used to bring in additional column values based on the user's selection for a parent Grid or ComboBox variable. This is a special variable type that does not display to the user in the Calc Method Variables dialog—it is only used to return additional related values into the calc method.
RelatedColumnValue variables must have a specified parent variable using the [DependsOn]
property. In this case, the purpose of the dependency is only to determine the parent value for which to return the related column values. The RelatedColumnValue variable does not need to be set up with any formulas in order to make this determination.
For example, imagine that you are prompting users to select an account to place in the calc method, and you also want to place the account description in the calc method. To do this, you first set up the parent variable to display a list of accounts. Then, you create a RelatedColumnValue variable to return the account description, and configure it as dependent on the parent Account variable.
When the user inserts this calc method and the Calc Method Variable dialog displays, only the Account variable is visible.
When the calc method is inserted, Axiom Financial Institutions Suite finds the specified column for the RelatedColumnValue variable—in this example, Acct.Description—and returns the value for the selected account. Both values are then placed into the specified relative locations within the calc method.
The Related Column Value variable provides an alternative to using GetData functions to return these associated values. Avoiding use of unnecessary GetData functions can improve file performance.
Visibility of dependent variables in the Calc Method Variables dialog
When setting up dependent variables, you should consider whether you want the dependent variable to be visible in the Calc Method Variables dialog from the start, or whether it should be hidden initially. Dependent variables behave as follows, based on the value of the [IsEnabled]
property:
-
If the dependent variable is enabled by default, then the dependent variable displays in the Calc Method Variables dialog when it opens, along with the parent variable. In this configuration, the user is not required to select a value for the parent variable before selecting a value for the child variable. You should make sure that the parent variable is configured as required, so that the user cannot skip the parent variable entirely.
-
If the dependent variable is not enabled by default, then the dependent variable is omitted from the Calc Method Variables dialog when it opens. Once the user selects a value for the parent variable, the dependent variable may or may not become visible in the dialog, depending on the formula that was used in the enabled setting. This configuration ensures that the user cannot select a value for the child variable until they have first selected a value for the parent variable.
For example, the formula might be set up so that once any value is set for the parent variable, the dependent variable becomes enabled. Or the formula might be set up so that the dependent variable only becomes enabled if the parent variable value meets a certain criteria.
NOTE: RelatedColumnValue variables never display to users. For these variables, the [IsEnabled]
property simply determines whether the RelatedColumnValue variable is processed or not when the parent variable value is selected.