none
collaps and expand all subtasks when filtering? RRS feed

  • Question

  • Hi!

    In the old Project so had i an nice function, i filter in one colume and when i colcapsed (-) one subtask and reopen it (+) in another colume so did the project show all subtasks under this subtask. Now when i have canged to project to 2010 and windows 7 is this function not working anymore?

    I heard that this could be solved with an macro or is there any other solution for this?

    Tuesday, April 2, 2013 7:44 AM

All replies

  • Hi Mikael,

    There have been several discussions on these forums about the ability to filter based upon Flag fields.  There are several posts about using macros to set flag fields for detail tasks and flagging summaries as well.

    See the following post:

    http://social.technet.microsoft.com/Forums/en-US/projectprofessional2010general/thread/28095262-557d-429f-b571-5f3ea8167ba0

    However, depending upon what you may try to filter for, you may be able to get what you need without the macro.  Many filters have the option to "show related summary rows".

    Let us know more about what you are trying to filter for and we'll see if we can help.

    Julie

    Tuesday, April 2, 2013 9:48 AM
    Moderator
  • Please elaborate a bit more.

    Sapna Shukla

    Tuesday, April 2, 2013 10:33 AM
    Moderator
  • Hi!

    I filter in one colume and in one other colume i have this tasks, subtask and some actions.

    in the old project was it like this, i just see this action that i have filtered out but if i closed the subtask and reopen it so could i see all six actions under this subtask.

    but in this projec 2010 i just see the action that i filtered how many times i close and open the subtask.

    Tuesday, April 2, 2013 11:19 AM
  • Hi,

    what you see is correct. That is one of the changes from 2007 to 2010. In fact, it is more correct in current version: A filter is still applied, even after collapsing and expanding.

    It is not what you are used to, but it now works in this way.
    Regards
    Barbara

    Tuesday, April 2, 2013 11:27 AM
    Moderator
  • couldent it be solved with an macro or somthing?

    Or do i just have to accept that this function is no longer in project?

    Tuesday, April 2, 2013 11:29 AM
  • So far I have not found any other solution than "accept", sorry.

    Others may have additional ideas?
    Barbara

    Tuesday, April 2, 2013 12:26 PM
    Moderator
  • I hope that someone else have an solution on this, i really like an need this funktion.
    Tuesday, April 2, 2013 12:28 PM
  • Mikael,

    If you can clearly define what you are filtering on we may be able to be of more help.  The autofilters appear to show related summary rows - but if a task is explicitly excluded it will not re-appear by expanding and collapsing.

    The link I mentioned sets flags for summary and subtasks - but again you must be able to define what you are searching for.

    Tuesday, April 2, 2013 8:58 PM
    Moderator
  • i have an task with some subtasks and some actions under the subtasks ( in this case 6 actions).

    In this case we can call the actions A,B,C,D,E,F,G and in next colume i have names for this actions like

    apple,banana,citrus,dragons,elfs,flags,pigs and i filter on citrus and the only action that is shown is C below all subtasks, in the old project could you collaps the subtask and expand it and you could see all actions A,B,C,D,E,F,G again but in this new project you only see action C even if you collaps and expand the sub task.

    Hope this clarify what i mean.

    hope that someone could support with some macros to solve this?


    Wednesday, April 3, 2013 5:28 AM
  • If this has been returned in 2013, great, someone plese let me know.

    I don't have an answer at this time. However, I 200% agres that the old functionality is preferable. We typically filter for tasks that have either "templated" names, if you will, or that have been categorized in some manner using text and or flag fields. Once you zoom in on the task(s) you are interested in it is frequently VERY useful to QUICKLY look at the rest of the task group. The old functionality of being able to close the group, reopen the group and see the rest of the task group allowed for this.

    The trade off was having to re-apply the filter to get it to go away. Yes, this could bite you when reporting and such. But the old functionality was useful many times a day. Reports and views are usually generated weekly or less often.

    If anyone is counting, I vote to bring back the old function. I'm also more than a little frustrated that this was taken away. How about something in Options > Advanced? If it's there now it's not clear to me what it is, sorry for being dense if that's the case.

    OXOX

    -jd

    Wednesday, June 26, 2013 11:08 PM
  • Hello again.

    Below is some code for a possible solution to this. It's still rough & it's time for dinner. It needs error handling and a lot of tidying up for sure. Any suggestions are welcome of course. 

    Right now if I select something in one of the tasks showing after the filter, I get the rest of the task group under the same summary task.

    Adding the "or" filter condition to the existing filter is a bit of a crap shoot. I know my filters and I think this will work for most of them. I need to test through some of the more complex filters. So ... just clean this up and get it on a button or something ...

    Hope this helps.

    Best,

    John

    ---- Code Below --------------------

    Option Explicit
    Sub modShowFliteredSubTasks()

    'Dim flsFilters As Filters
    Dim flFilter As Filter
    Dim slSelectionX As Selection
    Dim strFilterName As String
    Dim strNewFilterName As String
    Dim strStringX As String
    Dim strWBS As String

    Dim lngFilterIndex As Long
    Dim i As Long

    i = 0
    Set slSelectionX = Application.ActiveSelection
    strWBS = slSelectionX.Tasks.Item(1).WBS
    strWBS = Mid(strWBS, 1, Len(strWBS) - 2) 'need to check for outline level or something
    Debug.Print (strWBS)

    strFilterName = ActiveProject.CurrentFilter
    Debug.Print (strFilterName)

    i = 1
    For Each flFilter In ActiveProject.TaskFilters
        If flFilter.Name = strFilterName Then
           lngFilterIndex = i
        End If
        i = i + 1
    Next flFilter
    i = 0

    strNewFilterName = "temp-" & strFilterName

    For Each flFilter In ActiveProject.TaskFilters
        If flFilter.Name = "TempFilter" Then
            Application.OrganizerDeleteItem Type:=pjFilters, FileName:=ActiveProject.FullName, Name:="TempFilter"
        End If
    Next flFilter

    Set flFilter = ActiveProject.TaskFilters.Copy(strFilterName, "TempFilter")

    Debug.Print (flFilter.Name)

    strStringX = flFilter.FilterType

    Debug.Print (strStringX)
    Debug.Print (strWBS)


    FilterEdit Name:="TempFilter", _
        TaskFilter:=True, _
        Parenthesis:=True, _
        FieldName:="", _
        NewFieldName:="WBS", _
        Test:="equals", _
        Value:=strWBS & "*", _
        Operation:="Or", _
        ShowSummaryTasks:=True

    flFilter.Apply


    'Clean this mess up!
    Set flFilter = Nothing


    End Sub

    Thursday, June 27, 2013 2:31 AM
  • Good morning. Below is the code after some clean up and adding in a few lines to have the selection return to the task you were on when the module was invoked. Seems to be working with several different custom filters I use. I'd like to add something to get the screen position to return to where it started, but that's uncharted terrirtory for me and I don't have time to deal with it right now.

    At the least this will allow someone to expand a group of tasks under a summary row where a filter has been applied to the rest of the project and one does not want to "un-filter" everything else.

    Hope this helps. If you try this, please let me know if it does / does not work for you.

    Best,

    -jd

    -------------- Code Below --------------------------

    Option Explicit
    Sub modShowFliteredSubTasks()

    Dim flFilter As Filter
    Dim slSelectionX As Selection
    Dim strFilterName As String
    Dim strWBS As String
    Dim strTmpFltrNm As String 'for the temp filter name
    Dim lngRowX As Long
    Dim tfOK As Boolean

    'initialize variables & objects
    strTmpFltrNm = "ShowSubTasks"
    Set slSelectionX = Application.ActiveSelection

    'save where we are now so we can get back there
    lngRowX = slSelectionX.Tasks(1).ID

    strFilterName = ActiveProject.CurrentFilter

    strWBS = slSelectionX.Tasks.Item(1).WBS
    If slSelectionX.Tasks(1).OutlineLevel <> 1 Then
       strWBS = Mid(strWBS, 1, Len(strWBS) - 2)
    End If

    'see if the temp filter is still there and delete it if so.
    For Each flFilter In ActiveProject.TaskFilters
        If flFilter.Name = strTmpFltrNm Then
            Application.OrganizerDeleteItem Type:=pjFilters, FileName:=ActiveProject.FullName, Name:=strTmpFltrNm
        End If
    Next flFilter

    'copy the current filter to the temp filter
    Set flFilter = ActiveProject.TaskFilters.Copy(strFilterName, strTmpFltrNm)

    'add an or condition to the temp filter to show tasks in the WBS grouping
    FilterEdit Name:=strTmpFltrNm, _
        TaskFilter:=True, _
        Parenthesis:=True, _
        FieldName:="", _
        NewFieldName:="WBS", _
        Test:="equals", _
        Value:=strWBS & "*", _
        Operation:="Or", _
        ShowSummaryTasks:=True, _
        ShowInMenu:=False

    flFilter.Apply

    'now go back to where we started else Project dumps you at row one
    tfOK = Application.FindEx(Field:="ID", Value:=lngRowX, Test:="Equals")

    'Clean this mess up!
    Set flFilter = Nothing
    Set slSelectionX = Nothing


    End Sub

     

     

    • Proposed as answer by JPD444 Thursday, June 27, 2013 6:19 PM
    Thursday, June 27, 2013 4:53 PM
  • Below is a version with additions for:

    Prompting in the case a filter has not been selected

    Storing the last used filter, not the temp filter, in a field in the document properties. Note that right now you need to manually create the a document property called "Last Filter". This was done to fix the problem of it truncating the temp filter on a sequential run.

    Best,

    John

    ---- Code ---------------------

    Option Explicit
    Sub modShowFilteredSubTasks()

    'Need to handle case of "All Tasks" being the filter
    'Does not work with the auto filters, how to do that ... ???

    Dim flFilter As Filter
    Dim slSelectionX As Selection
    Dim strFilterName As String
    Dim strWBS As String
    Dim strTmpFltrNm As String 'for the temp filter name
    Dim lngRowX As Long
    Dim tfOK As Boolean
    Dim docPropsX As Office.DocumentProperties
    Dim docPropX As Office.DocumentProperty
    Dim numPropsX As Integer

     

    'initialize variables & objects
    strTmpFltrNm = "ShowSubTasks"
    Set slSelectionX = Application.ActiveSelection
    Set docPropsX = ActiveProject.CustomDocumentProperties

    If ActiveProject.CurrentFilter = strTmpFltrNm Then 'means this is a second pass with same filter
       For Each docPropX In docPropsX
          If (docPropX.Name = "Last Filter") Then
             strFilterName = docPropX.Value
                'see if the temp filter is still there and delete it if so.
             For Each flFilter In ActiveProject.TaskFilters
                 If flFilter.Name = strTmpFltrNm Then
                     Application.OrganizerDeleteItem Type:=pjFilters, FileName:=ActiveProject.FullName, Name:=strTmpFltrNm
                 End If
             Next flFilter
             Set flFilter = ActiveProject.TaskFilters.Copy(strFilterName, strTmpFltrNm)
             flFilter.Apply 'reset filter to previous filter
          End If
       Next docPropX
    Else 'first pass with selected filter
       strFilterName = ActiveProject.CurrentFilter
       'see if the temp filter is still there and delete it if so.
       For Each flFilter In ActiveProject.TaskFilters
           If flFilter.Name = strTmpFltrNm Then
               Application.OrganizerDeleteItem Type:=pjFilters, FileName:=ActiveProject.FullName, Name:=strTmpFltrNm
           End If
       Next flFilter
       Set flFilter = ActiveProject.TaskFilters.Copy(strFilterName, strTmpFltrNm)
       'use a custom document property to store the current filter name
       For Each docPropX In docPropsX
          If (docPropX.Name = "Last Filter") Then
             docPropX.Value = ActiveProject.CurrentFilter
          End If
       Next docPropX
    End If

    If strFilterName = "All Tasks" Then
        MsgBox ("A filter must be active." & vbCrLf & _
                "Please select a filter on the View tab," & vbCrLf & _
                "then try again")
        Exit Sub
    End If


       
    'save where we are now so we can get back there
    lngRowX = slSelectionX.Tasks(1).ID

    'Debug.Print (strFilterName)


    strWBS = slSelectionX.Tasks.Item(1).WBS
    If slSelectionX.Tasks(1).OutlineLevel <> 1 Then
       strWBS = Mid(strWBS, 1, Len(strWBS) - 2)
    End If

     


    'add an or condition to the temp filter to show tasks in the WBS grouping
    FilterEdit Name:=strTmpFltrNm, _
        TaskFilter:=True, _
        Parenthesis:=True, _
        FieldName:="", _
        NewFieldName:="WBS", _
        Test:="equals", _
        Value:=strWBS & "*", _
        Operation:="Or", _
        ShowSummaryTasks:=True, _
        ShowInMenu:=False
       
    For Each flFilter In ActiveProject.TaskFilters
       If flFilter.Name = strTmpFltrNm Then
          flFilter.Apply
          Exit For
       End If
    Next flFilter


    'now go back to where we started else Project dumps you at row one
    tfOK = Application.FindEx(Field:="ID", Value:=lngRowX, Test:="Equals")

    'Clean this mess up!
    Set flFilter = Nothing
    Set slSelectionX = Nothing


    End Sub

     

     

    • Proposed as answer by JPD444 Friday, June 28, 2013 1:48 AM
    Friday, June 28, 2013 1:47 AM