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…

Also this will work:

$zotto = $nietverwerkt>0 ? ‘on’ : ‘off’;
sc_btn_display(‘Verwerk’,$zotto);

I think the problem is in the macro’s parameter expansion

Dave

Hello,

Issue reported to our bugs team.

regards,
Bernhard Bernsmann

“Verwerk” is a created button?

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

Thank you!

[QUOTE=Thomas Soares;30495]“Verwerk” is a created button?

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

Thank you![/QUOTE]

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.

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…

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.

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!

[QUOTE=Thomas Soares;30508]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![/QUOTE]

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.

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.

Modifying the docs would do…