Dynamic Windows - Understanding Window Calculations

Version 7

    Verified Product Versions

    LANDESK Service Desk 7.6LANDESK Service Desk 7.7.xLANDESK Service Desk 7.8.xLANDESK Service Desk 2016.xLANDESK Asset Central 2016.x

    Window calculations are the backbone of Dynamic Windows.  It is not essential to be a code guru to get them working, however an understanding of the more common calculation structures is necessary.

    For information on Dynamic Windows in general, please see the LDSDDesigner manual for your version (7.6 and above) available here: http://community.landesk.com/support/community/servicedesk/documentation



    Here is a generic window calculation that sets the :SetHidden and :SetMandatory properties of a single target attribute, coloured to show how the different parts relate to each other:


    import System

    static def GetAttributeValue(Process_Object):

               Variable1 = true

               Variable2 = false

              if Process_Object.Related_Object != null and Process_Object.Related_Object.Attribute == 'value':

                         Variable1 = false

                         Variable2 = true

              return String.Format(":SetHidden(TargetAttribute, {0});:SetMandatory(TargetAttribute, {1});", Variable1, Variable2)





    Lines 1 & 2 - Standard for all calculations.

    Lines 3 & 4 – Declaring variables, Variable1 and Variable2, and setting their initial values to “true” and “false” respectively.

    Line 5 – Evaluation statement: If the Process_Object.Related_Object is not null (ie, whether a value has been selected or not), and if the Process_Object.Related_Object.Attribute contains a specific value, do the following…

    Lines 6 & 7 – If the statement in Line 5 is true, set Variable1 and Variable2 to “false” and “true” respectively.

    Line 8 – Return a string based on the output of the IF statement.

    Note: {0} and {1} are placeholders.  Their value represents the position of the variable in the list after the string specified in the quotation marks “”. In BOO you start counting at 0 not 1, so Variable1 matches up to {0} because it is at position 0 (ie, first) in the list, and Variable2 matches up to {1} because it is at position 1 (ie, second) in the list.