0

Formula Problem

if Schedule_V < 1 then
    styled(" UNDER PLANNED COST ", "white", "warn")
else
    if Schedule_V > 0 then
        styled(" OVER PLANNED COST ", "white", "ok")
    else
        if Schedule_V = Plan_V then
            styled(" GOOD ", "white", "ok")
        end
    end
end

This Formula don't giving me the result I want

The third if don't give me nothing

7 replies

null
    • Lars
    • 2 yrs ago
    • Reported - view

    Hi Rafael,

    it would help to know what values Schedule_V can have. But anyway, I think the numbers for comparison are not correct:

    • The first "if" matches for Schedule_V smaller than 1 - that's maybe ok
    • The second "if" matches for Schedule_V larger than 0 - that's not ok, because all values between 1 and 0 are already covered by the first "if"
    • And then, the third ... as I said: What value can Schedule_V have? Can you even reach the "else"-part?
    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view

    Lars

    I send a File is small module working to ad to my Master BD. (Working on Earned Value Management)

    The Problem is on EVM Table (KPI'sActivities) 

    • Fred
    • 2 yrs ago
    • Reported - view

    Building on Lars' comments, you can never get to the 2nd else because the first two ifs cover all possibilities.

    The first IF covers everything below 1 and the second IF covers everything above 0. So there is nothing that falls outside of those two scenarios.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 yrs ago
      • Reported - view

      Fred 

      Lars

      if Schedule_V > 0 then
          styled(" AHEAD OF SCHEDULE ", "white", "ok")
      else
          if Schedule_V = 0 then
              styled(" ON  SCHEDULE ", "white", "ok")
          else
              if Schedule_V < 0 then
                  styled(" BEHIND  SCHEDULE ", "white", "warn")
              end
          end
      end
      

      This work for the 3 options 

      • Fred
      • 2 yrs ago
      • Reported - view

       👍

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Once you have checked for =0 or >0 then all that's left is <0 so you can simplify this code to

    if Schedule_V > 0 then
        styled(" AHEAD OF SCHEDULE ", "white", "ok")
    else
        if Schedule_V = 0 then
            styled(" ON  SCHEDULE ", "white", "ok")
        else
            styled(" BEHIND  SCHEDULE ", "white", "warn")
        end
    end
    

    Regards John

    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view

    John Halls

    Excelent John Thanks 👍

Content aside

  • Status Answered
  • 2 yrs agoLast active
  • 7Replies
  • 49Views
  • 4 Following