8 Replies Latest reply on Jul 4, 2012 2:22 PM by dmshimself

    Create Related Attributes - (Calculations??)




      Is it possible to create fields that are related. I would like to add some kind of Risk Matrix into our Change process, but can't work out how you can calculate the outcome. So for example a user would select Business Impact = Low and then Likelyhood of Failure = High then the overall risk of the change would be calculated at Medium. Has anybody completed something like this??


      Kind regards,


        • 1. Re: Create Related Attributes - (Calculations??)

          A calculation would probably do what you want.  It would probably consist of setting a value to zero and then using a bunch if if-then statements to add or subtract from the value.  Then maybe another set of If-then to check the value and return a description if the number isn't enough.  You will see many examples of BOo calculations in the calculations section.


          The BOO web site was recently "upgraded" and sadly many examples do not exist yet.  It wasn't great before and it's worse now.

          • 2. Re: Create Related Attributes - (Calculations??)

            Yes I've done this sort of thing, but it isn't for the faint hearted.  You need to construct some careful BOO calculations to do what you need.


            So you program up the algorithm you need in BOO and then pull in actual values from reference lists like Business Impact Likelyhood of failrue and so on.  Here is an example.  Here several reference lists are used and each entry in the reference list has a score to add in.


            This calculation returns the Nth entry in a Request Assessment list, (High Medium Low) but you might be happy just to return a number


            import System
            static def GetAttributeValue(Change):
            Value = Change._ComplexityRating._Rating+Change._FrequencyRating._Rating+Change._PotentialImpactRating._Rating+Change._Numberofclientsaffectedr._Rating+Change._EffortRating1._Rating+Change._EstimatedCostRating1._Rating+Change._Linkagestoothersystemsra._Rating+Change._LinkagestootherchangesRa._Rating
            if Value >= 24:
              return Change.GetRankedObject("ChangeManagement._RequestAssessment", 3)
            if Value >=16 and Change._ExpediteChange._ExpediteChange == "Yes":
              return Change.GetRankedObject("ChangeManagement._RequestAssessment", 3)
            if Value >=16:
              return Change.GetRankedObject("ChangeManagement._RequestAssessment", 2)
            if Change._ExpediteChange._ExpediteChange == "Yes":
              return Change.GetRankedObject("ChangeManagement._RequestAssessment", 2)
              return Change.GetRankedObject("ChangeManagement._RequestAssessment", 1)

            • 3. Re: Create Related Attributes - (Calculations??)

              Not for faint hearted but definitely worth the effort.  We use calculations a lot.  They allow you to do really cool stuff that the Service Desk doesn't normally doesn't do.  Once you start using calculations you will find many more uses and it really help customize Service Desk way beyond what you thought was possible.


              However, there is also a dark side.  LANDesk support does not support calculation meaning your only help is here, .net web sites, and BOO web sites.  Currently the BOO web site is a mess and in need of serious work.  The examples here in the community show a lot useful bits of information but certainly not everything.  The other hassle is that unlike most IDE's, Service Desk has no step through or way to follow what is happening.  Typically you can step through your code one line at a time and then look at the variables to see what is going on.  With Service Desk, none of that exists.


              This is what I typically do:

              1. Insert a test at the trouble spot to return a value
              2. Add a return command to ignore the rest of my calculation
              3. Save the changes in the object
              4. Do an IISRESET
              5. Load your incident, change, problem, etc
              6. Make a change
              7. Check results
              8. See error
              9. Exit incident, change, problem, etc
              10. Load object again
              11. Edit calculation
              12. Repeat step 1 till it works


              I can sometimes use a query with a short cut in the design tab to making checking calculations easier.  In the end though, working with calculations can be very frustrating.  I know there is a Enhancement Request to add debugging abilities for calculations.  I would recommend everyone vote on that.  There is so little official documentation of BOO that I am tempted to write a manual myself.  Until I get annoyed enough to research BOO to death the community is your best source of information.


              I bet after reading all this your wondering if the effort is worth it.  Yes

              • 4. Re: Create Related Attributes - (Calculations??)



                Any suggestions on where I would start if I was wanting to "attempt" to teach myself BOO??  Reading previous posts you guys and many others are doing impressive things with calculations and I have no idea where to start.  Frankly reading Dave's example in this thread was like reading a foreign language!! 


                Is it a case of working through the BOO website (though you've put me off now saying it's a mess) and the labs on it?  And just to throw a spanner in the works the last thing I programmed in was BASIC during GCSE ICT!!!!!! 


                Cheers for any advice



                • 5. Re: Create Related Attributes - (Calculations??)

                  BASIC is a good start, Visual Basic would be better.

                  Calculation formula writing: Further reading on the Boo scripting language and .NET Framework


                  BOO has an unusual style, they call it Duck typing.  Once you get used to it things are not so bad.  Basically in a IF/THEN statement the THEN is replaced with a colon.  In visual basic you use Begin and End to do many things like in a FOR/NEXT loop.  In BOO they use indents and more specifically a space to show sections of code to be calculated.  Spacing is very crucial to BOO but otherwise its a standard top down approach.  You can use many of the C variations but the less confusing Basic formats (V = V + 1) also work.  There are a whole bunch of functions available to you as compared to BASIC so in a way things are much better.

                  • 6. Re: Create Related Attributes - (Calculations??)

                    Thanks Carl, much appreciated.



                    • 7. Re: Create Related Attributes - (Calculations??)

                      Hi Dave,


                      Sorry it has taken me a long time to muster up the guts to have a go at this.I think I am getting my head around boo slowly, I was just wondering when you were adding together the ratings in the example what data types are the rating attributes??




                      • 8. Re: Create Related Attributes - (Calculations??)

                        Mine were all int16.  Stus recent articles on calcualtions would be a great set  to go through too.  The first one is here, but you may have already found it