![]() |
| Previous Top Next |
Updating Nodes with Auto-Calculations |
You can copy the value (or result) of an Auto-Calculation to a node in the XML document. You do this as follows:
| 1. | Create the Auto-Calculation as described in Editing and Moving Auto-Calculations. |
| 2. | Select the Auto-Calculation and, in the Properties sidebar, click the Edit button of the Update XML node in Authentic property in the Authentic group of properties (screenshot below). |

| 3. | In the Schema Selector dialog that pops up (screenshot below), select the node to update and click OK to finish. |

The node to update is now specified.
The XPath expression must select a single node. If the XPath expression selects multiple nodes, no node will be updated.
IMPORTANT!
For a node in the XML document to be updated two conditions must be fulfilled:
| 1. | The XPath expression for the Auto-Calculation must include at least one value that is related to an XML node, i.e. a dynamic value. For example, Price*1.2. This expression involves the element Price, and is therefore dynamic. If the XPath expression contains a static value (for example, string("Nanonull, Inc.")), then the Update XML Node feature will not work. |
| 2. | Any one of the nodes used in the XPath expression must be modified in Authentic View—not in any other view. So, if the XPath expression is Price*1.2, and the Auto-Calculation is set to update the VATPrice node, then the Price element must be modified in Authentic View in order for the VATPrice node to be updated. |
Changing the node to update and cancelling the update
To change the node to update, click the Edit button of the Update XML Node property in the Authentic group of properties of the Auto-Calculation (in the Properties window) and then select the required node from the Schema Selector dialog box that pops up. To delete the Update XML Node property, click the Remove button in the toolbar of the Properties window.
Should you use the Auto-Calculation or the updated node contents for display?
If there are no conditional templates involved, you can use either the Auto-Calculation or the contents of the updated node for display. It is immaterial which one you choose because the node update happens immediately after the Auto-Calculation is evaluated and there is no factor to complicate the update. You should, however, be aware that there is a different source for the content displayed in each of the two cases.
Hiding the Auto-Calculation
You may find yourself in the situation where you wish to use an Auto-Calculation to make a calculation in order to update a node with the value of the Auto-Calculation. In this case, one of the following scenarios arise:
| • | You wish to display the result just once. You cannot hide the Auto-Calculation since it would then not be evaluated. If there is no conditional template involved, it is best to display the Auto-Calculation and not display the contents of the updated node. |
| • | You wish not to display the result, merely to update the node. The best way to handle this scenario is to apply text formatting to the Auto-Calculation, so that it is invisible on the output medium (for example, by applying a white color to an Auto-Calculation on a white background). |
See also:
Editing and Moving Auto-Calculations, for a description of how to use Auto-Calculations.
Auto-Calculations Based on Updated Nodes, on the issue of using updated nodes in Auto-Calculations.
Example: An Invoice, for a detailed example of using Auto-Calculations.
XPath Dialog, for a description of the Edit XPath Expression dialog.
|