How to see all Calculations directly in the database

Version 4

    Verified Product Versions

    Service Desk 7.6Service Desk 7.7.xService Desk 7.8.xService Desk 2016.xService Desk 2017.x

    Below is a script that will list all the calculations that you have in your database that are on an Attribute in Object Designer:.



    select T1.md_name 'Attribute Name', T1.md_title 'Attribute Title', T2.md_title 'Object', T3.md_title 'Module', T1.md_calculation_type 'Calculation Type', T1.md_calculation_formula 'Calculation Formula'
    from md_attribute_type T1, md_class_type T2, md_module T3
    where T1.md_class_type_guid = T2.md_guid and T2.md_module_guid = T3.md_guid and md_calculation_type != 0
    Order by T1.md_title


    The Calculation Type will let you know what type of Calculation it is. This is represented with a number.

    Below is a list of which number represents which Calculation Type:


    1 - Before Save

    2 - After Read

    3 - Scheduled

    4 - Window Calculation




    Below is a script that will list all fields within Actions in processes that contain a calculation

    (There may be multiple actions with the same name in a process so you may still have to hunt a little bit to find the right one but it should help.)


    SELECT lc_lifecycle_description.lc_title as 'Process', lc_action.lc_title as 'Action', md_attribute_type.md_title as 'Field', lc_action_value.lc_value as 'Calculation'
    FROM lc_action_value
    join lc_action on lc_action.lc_guid = lc_action_value.lc_action_guid
    join lc_lifecycle_description on lc_lifecycle_description.lc_guid = lc_action.lc_lifecycle_guid
    join md_attribute_type on md_attribute_type.md_guid = lc_action_value.lc_attribute_guid
    where lc_value like 'import%'
    order by lc_lifecycle_description.lc_title, lc_action.lc_title, md_attribute_type.md_title






    Below is a script that will list all Conditions within a Lifecycle containing a Calculation.

    Note that this will only show you a list of the Conditions Title along with what Class Type the Condition belongs to. It will not show you the exact Lifecycle that the Condition is added into.

    Please note the same condition can be in the multiple Lifecycles.


    select t1.lc_title 'Title', t1.lc_calculation_formula 'Calculation', t2.md_title 'Class Type'
    from lc_condition t1, md_class_type t2
    where lc_calculation_formula is not null and t1.lc_class_type_guid = t2.md_guid