Wouldn't it be useful a method to compare a variable to a number (or to a string) and use the result in a switch?
I often have to switch between a variable that is equal or greater than a value and I must to code a php function and use it or pass its result to a switch.
It would be easier if the Data Provider of switches could manage such comparisons, something like:
in read_data the format is:
in switch it could be:
and in Values setup:
maxx
I often have to switch between a variable that is equal or greater than a value and I must to code a php function and use it or pass its result to a switch.
It would be easier if the Data Provider of switches could manage such comparisons, something like:
in read_data the format is:
id/=:{data:field}or
id/<:{data:field}
in switch it could be:
{var:varname}/=:3or
{var:varname}/<:7
and in Values setup:
true:some code if the condition is truefalse:some code if the condition is false
maxx
That would be nice.
In the meantime one thing you could do:
Have ONE PHP action, with
Call the PHP action with {fn:my_php$value=(var:where_im_getting_the_value_from)&func=function_name_i_want}
In the meantime one thing you could do:
Have ONE PHP action, with
switch($this->get("func", "")) {so on and so forth.
case("function1"):
if($this->get("value", "") < 4) { return true; }
break;
Call the PHP action with {fn:my_php$value=(var:where_im_getting_the_value_from)&func=function_name_i_want}
In the meantime one thing you could do:
Have ONE PHP action, with
Thank you but a switch would be way better. 🙂
For readability of the code something like (other possible syntax for this new method) the following is much better:
{var:varname} as Data provider and as Values Setup:
<=3:{error:Too low value}
between 4 and 7:{success:Good!}
>7:{success:You won!}{fn:goto_bank}
This topic is locked and no more replies can be posted.