Skip navigation
2520 Views 3 Replies Latest reply: Aug 8, 2011 9:26 AM by mark.webb@bedford.gov.uk RSS
Rookie 19 posts since
Oct 13, 2010

Has received 1 of 9 achievements.
Currently Being Moderated

Apr 14, 2011 2:46 AM

How to group a query based on middle Category

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

  • gramsay Specialist 319 posts since
    Mar 4, 2009

    Has received 3 of 9 achievements.
    Currently Being Moderated
    1. Apr 14, 2011 4:54 AM (in response to mjohnson87)
    Re: How to group a query based on middle Category

    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.

  • Stu McNeill SupportEmployee 1,072 posts since
    Nov 11, 2008

    Has received 7 of 9 achievements.
    Currently Being Moderated
    2. Apr 14, 2011 5:32 AM (in response to gramsay)
    Re: How to group a query based on middle Category

    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.

  • mark.webb@bedford.gov.uk Apprentice 32 posts since
    Aug 13, 2009

    Has received 1 of 9 achievements.
    Currently Being Moderated
    3. Aug 8, 2011 9:26 AM (in response to Stu McNeill)
    Re: How to group a query based on middle Category

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

     

    Thanks

    Mark

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 20 points
  • Helpful Answers - 10 points
LANDESK Community powered by Jive SBS® 4.5.7.1  |  Legal Notices  |  Privacy Policy  |  Icon 

TweeterOn Twitter  |  Icon FacebookOn Facebook © 2007 LANDESK Software