The calculation editor comprises five main areas:
Editor – The central area of the calculation editor is where you define your calculation. When you create a new calculation, the outline of the calculation is added for you automatically:
import System static def GetAttributeValue(Incident): Value = return Value
where Incident is the name of the object that the calculation is based on.
You need to leave the first two lines of this calculation as they are. The Value = line is where you add the definition of the calculation, and the return Value line states the result that will be returned by the calculation.
Value is the default variable name. You can change this to something more meaningful for your calculation - but if you change Value = , remember to also change return Value to match.
The lines Value = and return Value have a single indentation. The level of indentation of the different lines in a calculation determines the scope of different areas of complicated calculations. It is very important that you ensure the indentation of the calculation is consistent and correct.
You can type your calculation in the Editor area, or you can use the three areas to the left to build your calculation. You can extend your calculation beyond the basics provided by the calculation editor by using the Boo language (for more information, see http://www.boo-lang.org).
When you have entered your calculation, click Test Syntax to confirm that the calculation contains no errors in its structure. Note that this tests only the syntax of your calculation, and not that the calculation is using valid attributes.
The Test Calculation button enables you to test the result of a calculation without having to complete the rest of your design. When you click Test Calculation, the Test Calculation dialog appears, showing the results of the default query for the object that your calculation is based on. You can then select a record from this list, and a dialog reports the value of the calculation that would be returned for the selected record.
The Reset button resets the calculation to the original form that was last saved to the database.
Attributes – the Attributes tree displays all of the attributes that are available to the calculation from the calculation's object. To add an attribute to your calculation, click the required position in the editor, then double-click the attribute that you want to add.
Operators – you can double-click the mathematical operators to add them to your calculation, or type them directly. The Operators list shows which operators you can use.
Functions – a number of functions are provided that enable you to include specific values from your database in your calculation.
For details about the usage of the provided functions, see Calculation functions.
Dependencies – lists the attributes referred to in your calculation that will cause the value of the calculation to change. The system needs to monitor these attributes for changes so that your calculation updates when the dependent attributes change.
Select the Auto-detect dependencies check box to have the system maintain the Dependencies list for you. Be aware that if your calculation becomes complex (for example, if it refers to attributes on related objects), you will have to maintain the dependencies yourself.
The Dependencies panel appears only for Before Save and Window Calculation calculation types.
Copyright © 2018, Ivanti. All rights reserved.