3 Replies Latest reply: Aug 8, 2011 9:26 AM by mark.webb@bedford.gov.uk RSS

    How to group a query based on middle Category

    Rookie

      Hello,

       

      In our system our category list has 3 tiers. For example 'Application A to B, Access 2003, Unable to load'. What I'm wanting to do is group the query based on the middle tier (Access 2003) but all I can group the query on is either Category.Full Name which brings up all 3 tiers in the category or Category.Title which brings up the last tier (Unable to load).

      Is there anyway I can group the query based on the middle tier, for example Access 2003?

       

      Thanks

      Matt

        • 1. Re: How to group a query based on middle Category
          gramsay Specialist

          You can do this if you add a calculated field to the category object.

          Call it "Parent Category" and add it to the category window.

           

          Your calculation will be:

           

          import System

          static def GetAttributeValue(Category):

          Value = Category.Parent.Title

          return Value

           

           

           

          Set Calculation Type to scheduled and create a bulk action in schedule manager to update existing categories.

           

          When done change the calculation type to "After Read" to update any new categories you add. The category window must have your new field and the Parent attribute showing and the calculation handler (OnValueChanged) for this needs to be added.

           

          Your group query can then be created using your new "Parent Category" to group your results.

          • 2. Re: How to group a query based on middle Category
            Stu McNeill Employee

            You shouldn't need a new attribute to hold this, you should be able to just get to Category.Parent in the query design.

             

            However either way will only work if all your incidents have the category set at the 3rd level.  Otherwise the parent might be the top level or even blank.

            • 3. Re: How to group a query based on middle Category
              mark.webb@bedford.gov.uk Apprentice

              How? Please explain as I'm trying to achieve this, getting the parent (or top level of a category) in a query.

               

              Thanks

              Mark