none
how to get fields in filters RRS feed

  • Question

  • Hi,

    I am doing a VSTO in MS Project. And my problem is, I created a form that listed all filters in the project. I need the user to select from it. Now I need to know the fields of that filter. Is there a way?

    Thanks,

    Gilbert


    Wednesday, March 21, 2018 3:00 AM

All replies

  • Hi Gilbert,

    Since your problem is related to MS project, I will move this thread to corresponding forum: Project Server > Project Customization and Programming Forum for dedicated information.

    Thank you for your understanding.

    Regards,

    Frankie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 21, 2018 8:22 AM
  • Gilbert,

    It seems like a rather strange request. Why would you need to know which fields are used in the filter?

    As far as I know there is no way to determine which fields the filter operates on other than visually. There may be some way to do it indirectly but that would take some thinking.

    John

    Wednesday, March 21, 2018 1:47 PM
  • Hi John,

    I am doing a network diagram. I am doing a detailed analysis of the project, in which the user do not  need to study the whole project, by just running my application, the user will have an overview of the entire project. part of this is the network diagram.

    Thanks,

    Gilbert


    Friday, March 23, 2018 5:29 AM
  • Gilbert,

    Okay, but that didn't really answer the question about why you need to know which fields are used by a filter. And without a better understanding I can't suggest any possible workarounds.

    John

    Friday, March 23, 2018 3:10 PM
  • Hi John,

    the network diagram will show the connections of tasks to their successors. the user will choose what filter to use, from that, I will get all data based on the filtered tasks then draw the diagram, I would need to export them to excel. I can show the filter names on the window form I created, but there is no way I can know the fields used for filtering.

    Thanks,

    Gilbert

    Tuesday, March 27, 2018 12:17 AM
  • John, this is different from my question, how can I apply taskgroupings? in filter there is a method apply, but for group, there is none.

    Thanks,

    Gilbert


    Tuesday, March 27, 2018 12:56 AM
  • Gilbert,

    If you know which filter is selected then you also will know which fields form the filter criteria because you, or someone in your organization, created the filters originally. So perhaps you reference a field look-up subroutine in your code or pull it from a separately stored Excel worksheet of filters and fields. The only way this doesn't work is if users create their own filter. Is that the case here?

    Even if the user creates and applies their own filter, you should still be able to loop through all ActiveSelection.Tasks to pull out whatever fields you need for your Excel analysis.

    John

    Tuesday, March 27, 2018 2:07 AM
  • Gilbert,

    Yes there is, use the GroupApply Method. Check the Project object browser for syntax.

    John

    Tuesday, March 27, 2018 2:08 AM
  • Hi John,

    I cant find any GroupApply method, or am I missing something?

    Thanks,

    Gilbert

    Thursday, April 19, 2018 2:24 AM
  • Gilbert,

    The GroupApply method is readily available in Project VBA, but in a VSTO project you need to call it explicitly as a member of a named MSProject.Application object.  (E.g. Dim projapp as MSProject.Application; then projapp.GroupApply.) 

    By the way, I believe that filter fields are (like a few other display-oriented variables) not code-readable in either vba or VSTO.  Conceivably, you might have some success with some brute-force modifications and creative error-handling, but it's hard to see such an approach being reliable for any user-created filter in general.   

    Good luck, tom 

    Thursday, April 19, 2018 3:07 AM