Announcement

Collapse
No announcement yet.

Ifelse sentence issues

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ifelse sentence issues

    Dear All,

    Im trying to create this sentence

    if({lunes}!= '0.00')
    {
    sc_field_disabled("martes=true; miercoles=true; jueves=true; viernes=true; sabado=true; domingo=true");
    }
    elseif ({lunes}== '0.00')
    {
    sc_field_disabled("martes=false; miercoles=false; jueves=false; viernes=false; sabado=false; domingo=false");
    }

    elseif ({martes}!= '0.00')
    {
    sc_field_disabled("lunes=true; miercoles=true; jueves=true; viernes=true; sabado=true; domingo=true");
    }
    elseif ({martes}== '0.00')
    {
    sc_field_disabled("lunes=false; miercoles=false; jueves=false; viernes=false; sabado=false; domingo=false");
    }

    elseif ({miercoles}!= '0.00')
    {
    sc_field_disabled("lunes=true; martes=true; jueves=true; viernes=true; sabado=true; domingo=true");
    }
    elseif ({miercoles}== '0.00')
    {
    sc_field_disabled("lunes=false; martes=false; jueves=false; viernes=false; sabado=false; domingo=false");
    }

    elseif ({jueves}!= '0.00')
    {
    sc_field_disabled("lunes=true; martes=true; miercoles=true; viernes=true; sabado=true; domingo=true");
    }
    elseif ({jueves}== '0.00')
    {
    sc_field_disabled("lunes=false; martes=false; miercoles=false; viernes=false; sabado=false; domingo=false");
    }

    elseif ({viernes}!= '0.00')
    {
    sc_field_disabled("lunes=true; martes=true; miercoles=true; jueves=true; sabado=true; domingo=true");
    }
    elseif ({viernes}== '0.00')
    {
    sc_field_disabled("lunes=false; martes=false; miercoles=false; jueves=false; sabado=false; domingo=false");
    }

    elseif ({sabado}!= '0.00')
    {
    sc_field_disabled("lunes=true; martes=true; miercoles=true; jueves=true; viernes=true; domingo=true");
    }
    elseif ({sabado}== '0.00')
    {
    sc_field_disabled("lunes=false; martes=false; miercoles=false; jueves=false; viernes=false; domingo=false");
    }

    elseif ({domingo}!= '0.00')
    {
    sc_field_disabled("lunes=true; martes=true; miercoles=true; jueves=true; viernes=true; sabado=true");
    }
    elseif ({domingo}== '0.00')
    {
    sc_field_disabled("lunes=false; martes=false; miercoles=false; jueves=false; viernes=false; sabado=false");
    }



    when I probe the first IF it works but the others doesnt work.

    I dont know if I writting bad the sentence or something like that.

    If anybody can help me Id apreciate it.

    Thanks in advance for your help.

  • #2
    Hi,
    you have to check every variable/field in a separate If..else structure.

    if({lunes}!= '0.00')
    {
    sc_field_disabled("martes=true; miercoles=true; jueves=true; viernes=true; sabado=true; domingo=true");
    }
    else
    {
    sc_field_disabled("martes=false; miercoles=false; jueves=false; viernes=false; sabado=false; domingo=false");
    }

    if ({martes}!= '0.00')
    {
    sc_field_disabled("lunes=true; miercoles=true; jueves=true; viernes=true; sabado=true; domingo=true");
    }
    else
    {
    sc_field_disabled("lunes=false; miercoles=false; jueves=false; viernes=false; sabado=false; domingo=false");
    }

    and so on.

    jsb

    Comment


    • #3
      I modified the code as you said but is weird only works for the 2 last fields

      Comment


      • #4
        Well, since you are overwriting all your actions from the steps before it will always be {sabado} and {doming} who determine
        the status of all the other fields. If you don't want this, you have to go a different approach.

        jsb

        Comment


        • #5
          Thank you so much, I already could fix it, I created if and else for each day in different method and I applied the method for each day only

          Comment

          Working...
          X