Announcement

Collapse
No announcement yet.

Ternary operators not working properly

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

  • Ternary operators not working properly

    Just a need to know, it of course should work but it doesnt.
    THIS: sc_btn_display('Verwerk',$nietverwerkt>0 ? 'on' : 'off'); does not work.

    THIS:
    if ($nietverwerkt>0){
    sc_btn_display('Verwerk','on');
    }else{
    sc_btn_display('Verwerk','off');
    }

    does work....

    And that goes for several other functions in scriptcase..
    I guess the parser is a bit sloppy..

  • #2
    Hello,

    Issue reported to our bugs team.

    regards,
    Bernhard Bernsmann

    Comment


    • #3
      "Verwerk" is a created button?

      If yes, this macro don't hide or show your button, only scriptcase buttons.

      Thank you!
      Best regards,
      Thomas Soares.
      ScriptCase International.

      Email: t.soares@scriptcase.net
      Visit our Blog: http://www.scriptcase.net/blog/
      Visit out fan page: http://www.facebook.com/Scriptcase

      Comment


      • #4
        Originally posted by Thomas Soares View Post
        "Verwerk" is a created button?

        If yes, this macro don't hide or show your button, only scriptcase buttons.

        Thank you!
        That is new to me and afaik not true either. We create custom buttons all the time and show/hide them where needed. The issue is that between () the statement is not interpreted. So either it should be documented that it's not able to, or it's something to correct.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          As aducom said (he is right .. again...) . 'Verwerk' is a normal php button. I see no reason why I shouldnt be able to hide it. And I can hide it. The point is that a ternary operator doesnt work here.
          I expected it to so I just reported it. I simply use the if version now...

          Comment


          • #6
            Originally posted by aducom View Post
            That is new to me and afaik not true either. We create custom buttons all the time and show/hide them where needed. The issue is that between () the statement is not interpreted. So either it should be documented that it's not able to, or it's something to correct.
            Sorry for my lack of knowledge, did not take into consideration the second code, and realized that the macro does not interpret the php condition within the macro.

            Let me study this problem with one of our developers and return you if it is a problem or the solution itself.

            Thank you.
            Best regards,
            Thomas Soares.
            ScriptCase International.

            Email: t.soares@scriptcase.net
            Visit our Blog: http://www.scriptcase.net/blog/
            Visit out fan page: http://www.facebook.com/Scriptcase

            Comment


            • #7
              Hello again,

              I checked with the responsible person and the same reported that the macro does not support this type of operation.

              See the example performed for your solution.

              $oi = 0;
              $display = $oi>1 ? 'off' : 'on';
              sc_btn_display('new',$display);

              I hope this solves your problem.

              Thank you!
              Best regards,
              Thomas Soares.
              ScriptCase International.

              Email: t.soares@scriptcase.net
              Visit our Blog: http://www.scriptcase.net/blog/
              Visit out fan page: http://www.facebook.com/Scriptcase

              Comment


              • #8
                Originally posted by Thomas Soares View Post
                Hello again,

                I checked with the responsible person and the same reported that the macro does not support this type of operation.

                See the example performed for your solution.

                $oi = 0;
                $display = $oi>1 ? 'off' : 'on';
                sc_btn_display('new',$display);

                I hope this solves your problem.

                Thank you!
                That's what I expected. It's not a big deal, but I recommend this to put into your helpfile. I couldn't find it. If you expect it to work the php way (and that's a logical thing to do) then you are loosing a lot of time to find out the it is not supposed to work that way.
                Albert Drent
                aducom software netherlands
                scriptcase partner, reseller, support and (turn-key) development
                www.scriptcase.eu / www.scriptcase.nl

                Comment


                • #9
                  Hello,

                  I will report this case for it to be implemented in PHP code in macros without problems, but I can not say that it will be implemented.

                  Thank you.
                  Best regards,
                  Thomas Soares.
                  ScriptCase International.

                  Email: t.soares@scriptcase.net
                  Visit our Blog: http://www.scriptcase.net/blog/
                  Visit out fan page: http://www.facebook.com/Scriptcase

                  Comment


                  • #10
                    Modifying the docs would do...
                    Albert Drent
                    aducom software netherlands
                    scriptcase partner, reseller, support and (turn-key) development
                    www.scriptcase.eu / www.scriptcase.nl

                    Comment

                    Working...
                    X