Conditions and Auto-Calculations

www.altova.com Expand/Collapse All Print this Topic Previous Page Up One Level Next page

Home >  SPS File: Advanced Features > Conditions >

Conditions and Auto-Calculations

When using Conditions and Auto-Calculations together, there are a few issues to bear in mind. The two most fundamental points to bear in mind are:

 

Only Auto-Calculations in visible conditionsthat is the branch selected as trueare evaluated.
Auto-Calculations are evaluated before Conditions.

 

Here are a few guidelines that summarize these issues.

 

1.If an Auto-Calculation updates a node, and if that node is involved in a Condition (either by being in the XPath expression of a branch or in the content of a conditional template), then keep the Auto-Calculation outside the condition if possible. This ensures that the Auto-Calculation is always visibleno matter what branch of the condition is visible. If the Auto-Calculation were inside a branch that is not visible, then it would not be triggered.
2.If an Auto-Calculation must be placed inside a condition, ensure (i) that it is placed in every branch of the condition, and (ii) that the various branches of the condition cover all possible conditions. There should be no eventuality that is not covered by a condition in the Conditional Template; otherwise there is a risk (if the Auto-Calculation is not in any visible template) that the Auto-Calculation might not be triggered.
3.If you require different Auto-Calculations for different conditions, ensure that all possible eventualities for every Auto-Calculation are covered.
4.Remember that the order in which conditions are defined in a conditional template is significant. The first condition to evaluate to true is executed. The otherwise condition is a convenient catch-all for non-specific eventualities.

 

 

 


© 2019 Altova GmbH