none
Filter out tasks with no deadline RRS feed

  • Question

  • We use Project Server 2013 and Project Professional 2013.

    I would like to identify all tasks that have no deadlines, i.e. Deadline = "NA". I can do this is MS Project by filtering all tasks with a deadline date that is greater than the largest deadline date of any task.

    How can I do this in a filter that is in a PWA view?

    Monday, October 23, 2017 6:08 AM

Answers

  • Hi,

    yes, if you need it on resource assignment level, you will need a macro. But if you have to use a macro, you can also omit the formula.

    Sub MyDeadline()
    Dim P As Project
    Dim T As Task
    Dim R As Resource
    Dim At As Assignment
    Dim Ar As Assignment
    Dim RFId As Double
    Dim TFId As Double
    Dim DeadlineSet As String
    
    Set P = ActiveProject
    
    TFId = Application.FieldNameToFieldConstant("DeadlineTask", pjTask)
    RFId = Application.FieldNameToFieldConstant("DeadlineResource", pjResource)
    
    For Each T In P.Tasks
        If Not T Is Nothing Then
            If IsDate(T.Deadline) Then
                DeadlineSet = "Yes"
            Else
                DeadlineSet = "No"
            End If
            'need to use "SetField" for task fields
            T.SetField FieldID:=TFId, value:=DeadlineSet
            If T.Assignments.Count > 0 Then
                For Each At In T.Assignments
                    '"SetField" not available on assignmentlevel. Therefore, field name must not contain "blanks" to access them directly
                    At.DeadlineTask = DeadlineSet
                    Set R = At.Resource
                    For Each Ar In R.Assignments
                        If Ar.TaskID = T.ID Then
                            '"SetField" not available on assignmentlevel. Therefore, field name must not contain "blanks" to access them directly
                            Ar.DeadlineResource = DeadlineSet
                        End If
                    Next Ar
                Next At
            End If
        End If
    Next T
    End Sub
    

    Regards
    Barbara

    • Marked as answer by HFprojects Monday, October 23, 2017 2:55 PM
    Monday, October 23, 2017 11:34 AM
    Moderator

All replies

  • Hi,

    I solved this request with an Enterprise Custom Field on Task level, Type Flag, Calculation for summary "use formula" and formula 'ProjDateValue([Deadline]) = 4294967295'.

    Afterwards I use this field for filtering views in browser.

    Perhaps a solution for you?

    Barbara

    Monday, October 23, 2017 8:26 AM
    Moderator
  • Hi Barbara

    That is a very good option but, please correct me if I'm wrong, I wouldn't be able to display this custom field in a Resource Assignments view. The reason is that it has a formula, and I'd then need to run a macro to save the data in a regular field. Something like this:

     projectField = FieldNameToFieldConstant("Deadline_formula")
     newValue = t.GetField(FieldNameToFieldConstant("Deadline_no_formula"))
     t.SetField FieldID:=projectField, Value:=newValue

    I could then Filter on Deadline_no_formula in the View.

    Would this be the easiest way to implement it?

    Monday, October 23, 2017 9:29 AM
  • Hi,

    yes, if you need it on resource assignment level, you will need a macro. But if you have to use a macro, you can also omit the formula.

    Sub MyDeadline()
    Dim P As Project
    Dim T As Task
    Dim R As Resource
    Dim At As Assignment
    Dim Ar As Assignment
    Dim RFId As Double
    Dim TFId As Double
    Dim DeadlineSet As String
    
    Set P = ActiveProject
    
    TFId = Application.FieldNameToFieldConstant("DeadlineTask", pjTask)
    RFId = Application.FieldNameToFieldConstant("DeadlineResource", pjResource)
    
    For Each T In P.Tasks
        If Not T Is Nothing Then
            If IsDate(T.Deadline) Then
                DeadlineSet = "Yes"
            Else
                DeadlineSet = "No"
            End If
            'need to use "SetField" for task fields
            T.SetField FieldID:=TFId, value:=DeadlineSet
            If T.Assignments.Count > 0 Then
                For Each At In T.Assignments
                    '"SetField" not available on assignmentlevel. Therefore, field name must not contain "blanks" to access them directly
                    At.DeadlineTask = DeadlineSet
                    Set R = At.Resource
                    For Each Ar In R.Assignments
                        If Ar.TaskID = T.ID Then
                            '"SetField" not available on assignmentlevel. Therefore, field name must not contain "blanks" to access them directly
                            Ar.DeadlineResource = DeadlineSet
                        End If
                    Next Ar
                Next At
            End If
        End If
    Next T
    End Sub
    

    Regards
    Barbara

    • Marked as answer by HFprojects Monday, October 23, 2017 2:55 PM
    Monday, October 23, 2017 11:34 AM
    Moderator
  • This is an excellent and extremely elegant solution to the problem.

    Thank you very much!

    Monday, October 23, 2017 2:55 PM