3 Replies Latest reply on Dec 7, 2012 4:48 AM by smiddleton

    Calculations in Queries

    Rookie

      Is there a way to calculate and display these in a query?  I would like to display the number of days an Incident has been open.  Along the same line I'd like to be able to sort by the incidetn urgency's rank, but display the title.  Not sure if this is possible in the query designer or this is best handled as a Crysal Report.

       

      Thanks in advance

        • 1. Re: Calculations in Queries
          Terry-Courtney Employee

          Hi Celso,

           

          If the calculation you have on a business object attribute is set to "After Read" this should then calculate when you run the query as you are effectively "Reading" the attribute.

           

          As for the urgency rank but displaying the title, just do the following:

           

          - Add the title and rank to your query fields.

           

          - Go to the properties of the rank field and under the Appearance tab remove the tick from "Show Column"

           

          - Apply sorting to the field "rank" as normal!

           

          Hope that helps!

          1 of 1 people found this helpful
          • 2. Re: Calculations in Queries
            Rookie

            Terry,

             

            Brilliant solution to the Urgency (title vs rank), that can be very useful.  My client wants to be able to sort by other fields as well (from the web access), so I don't necessarily want to the query sorted on one specific field all the time.  I'll try your suggestion and see if that can possibly allow resorting (or changing from ascending to descending).

             

            The calculation I was hoping to do was on the query itself, if that's even possible,  I suppose I could add an attribute if that's the only way to get this to work.

             

            Thanks for your reply!

            Celso

            • 3. Re: Calculations in Queries
              smiddleton Expert

              HI Celso,

               

              I doun't believe you can do the calculation directly in the query designer, so you will need to add an attribute to the object the query is being written on and make it an after read calc as Terry suggested.

               

              As to the sorting, you can again follow Terry's suggestion as this will in effect be the default sorting. Anyone running the query in webdesk has the option of changing the sort order by right clicking the column headings.

               

              Regards,

              Steve