Home Forums Discussion Running Queries based on a user inpu

This topic contains 4 replies, has 1 voice, and was last updated by  Thomas Boyle 4 weeks, 1 day ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #414309 Reply

    ben

    I am using MSP 2010 and not sure if I am imagining this but wonder if this is possible.

    I want a flag to go to yes based on a user input for example if the user input is 10 the flag will go to yes where the numeric field shows 10 or any number that the user has selected. Is this possible?

    Thanks

    #414311 Reply

    Matthias Müller

    Yes, it is possible by using a formula for the flag field. Just use the If statement to test for the number where the flag should switch to YES.
    Hope I could help.

    #414316 Reply

    ben

    Hi Matthias,

    Thanks for that, which is what I am doing. What I want is the flag to change depending on what number is selected. For example in a numeric field I have items marked 1-5, there will be many number 1’s, 2’s etc, but I have one flag field. So the formula would have to reflect a value the usrt has selected so if they pick 1 the flag will say yes for each occurrence of 1.

    So I am trying to find out is there a way the formula would re-write itself based ona value selected by the user.

    #414349 Reply

    Matthias Müller

    Maybe I do not fully understand what you desire.
    You can make a Flag field change by using this formula for example:
    (If Number1=1,YES,NO). Instead of the NO expression you can use also nested Ifs. Just insert the same expression for the NO statement and alter the number that also should turn the Flag field to YES.

    If this is not quite what you want, maybe consider using several Flag fields instead.

    #414351 Reply

    Thomas Boyle

    Ben,
    I don’t think you can make a custom field formula dependent on user input. From what you’ve written, each task has a number assigned either manually or with a formula, say in the Number1 custom field. You would like to automatically flag (using Flag1) only those tasks whose assigned number matches some selected criterion.
    This is easiest to do using vba. For example, the following procedure opens an input box and asks which value (in the Number1) field you would like to flag. Then it sets Flag1 to “Yes” for all tasks whose Number1 matches the selection (“No” for all others.)

    Sub ConditionalFlag()
    Dim t As Task
    Dim k As Long
        k = InputBox("Enter Number to Flag")
        
        For Each t In ActiveProject.Tasks
            If Not t Is Nothing Then
                If t.Number1 = k Then
                    t.Flag1 = "Yes"
                Else
                    t.Flag1 = "No"
                End If
            End If
        Next t
    
    End Sub
    
Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Running Queries based on a user inpu
Your information:




65 − 55 =