Announcement

Collapse
No announcement yet.

IF sentences issues

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

  • IF sentences issues

    Dear All,

    Im trying to disable some fields when the field has value different 0, and enable it again when the field has value 0. I got this code but only works for the first field.

    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.

    If anybody can help me Id apreciate it.

    Thanks in advance for your help.

  • #2
    Shouldn't

    Code:
    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");
    }
    be

    Code:
    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");
    }
    
    if ({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");
    }
    ??

    (all is done with elseif, even the new vars? perhaps correct, but doesn't sounds logical to me)
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      I now see that this post has been done three times. Please don't do that.
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Ok sorry, the fields are {lunes}, {martes}, {miercoles}.{jueves},{viernes},{sabado} and {domingo}, Im trying to do when {lunes} has a value different 0 disable the other fields and when it has 0 value enable the fields, and do the same process with the other fields

        Comment


        • #5
          Originally posted by placks View Post
          Ok sorry, the fields are {lunes}, {martes}, {miercoles}.{jueves},{viernes},{sabado} and {domingo}, Im trying to do when {lunes} has a value different 0 disable the other fields and when it has 0 value enable the fields, and do the same process with the other fields
          Never go more than Lunes because it's impossible to continue

          Elseif works if.previous condition is.false,but.you never.will pass from lunes!=0 or lunes==0 because always one of both conditions is.true.

          I hope.I explained correctly
          /Giuseppe

          Professional Scriptcase Services
          Some Customers opinions

          Comment

          Working...
          X