Setting up the window calculations

There are two stages to setting up a dynamic window:

  • Create a calculation that returns a Window Function on an attribute in Object Designer
  • Design the window to run the calculation using Window Manager

The two procedures below demonstrate how to make the Impact field on the Incident window mandatory if the Urgency field is completed. You use similar techniques for the other Window Functions. Further example calculations are given later.

To create the calculation:
  1. Start Object Designer, and open the object for the window.
    In our example, this is Incident Management\Incident.
  2. Create a new string attribute with Max. Length set to -1 to store the calculation.

We recommend that the names of your calculation attributes start with DynamicWindow, to make them easier to find in the designers.

  1. Set the new attribute's Calculation Type to Window Calculation.
    The Edit Formula dialog appears.
  2. Clear the Auto-detect dependencies check box.
    We will set the dependencies ourselves.
  3. Create a calculation that sets the Value to ":SetMandatory(attribute, True)".
    In our example, to make the Impact attribute mandatory, type the following calculation:
Copy
import System
static def GetAttributeValue(Incident):
    Value = ":SetMandatory(_Impact, True);"
    return Value

This example calculation is not one that you would use in a live system. Although it makes Impact mandatory if the Urgency field is completed, it does not handle resetting the field if the Urgency field is changed again later. This example is included only as part of demonstrating the procedures for setting up dynamic windows. The more complete calculation is described later.

The lines beginning with Value and return in the example above have a single indent. If you copy examples from here, make sure that the correct indentations are maintained when you paste them into the calculation editor.

:SetMandatory uses the attribute's name only. Do not include the object name (for example, do not use Incident._Impact). Remember that if the attribute was not a system attribute, it will begin with an underscore (for example, _Impact).

You can update multiple target attributes by separating them with semi-colons. For example:
Value = “:SetMandatory(attribute1,True);:SetMandatory(attribute2,False);”

  1. Drag the attribute that causes the calculation to be run from the Attributes tree to the Dependencies pane.
    For our example, drag Incident Urgency. Note that the internal database name for the attribute – _IncidentUrgency – appears in the Dependencies pane.
  2. Click OK.
    The Edit Formula dialog closes.
  3. Click .
    The changes to the object are saved.

Now that you have created the calculation that sets the field to mandatory, you can set up the window to use it.

To set up the window:
  1. In Window Manager, open the required window.
    In our example, this is an Incident window.
  2. Add the calculated attribute that you created above onto the window.

The attribute must be added to the window, but can be hidden by setting the ShowOnWindow property to False. We recommend that you set ShowOnWindow to True while you design and test the calculation.

  1. Select the control that you want to use to trigger the calculation.
    This is the attribute that you added to the Dependencies pane in the calculation. In our example, this is Urgency.
  2. In the Properties grid for the control, set Is calculate on change to True.
  3. Save the changes to the window.

When a user selects an Urgency on the Incident window, the calculation is triggered and the value of the calculated attribute is set to :SetMandatory(_Impact, True);. This then makes the Impact field become mandatory.