:foreach counter in=[/ip hotspot active find ] do={
:set datadown [/ip hotspot active get $counter bytes-out]
:if ( [$counter bytes-out =“0”] ) do={
this is not all the script but my exactly error is this code :if ( [$counter bytes-out =“0”] )
i need to get if this user is limited or not .. so if not i will limit his account
i have tried to do it several times by so many ways but still not working
i have tried spaces , marks and different scripts but still not working ![]()
my current OS version is 5.2 .
i hope u can find solution for me , Thanks.
You’re using “set” to define a variable that has not been defined would be my guess. Define the variable with :local like bellow since you should only need access to it within that loop. Only use :set if you need to set the value after it has been defined earlier. Then you can use the value you just set to “datadown” and do a comparison between them. Also do not put a quotation around the 0, by doing so you define it as a string type variable instead of a number, and you cannot do value comparisons between strings and numbers.
:foreach counter in=[/ip hotspot active find ] do={
:local datadown [/ip hotspot active get $counter bytes-out]
:if ( $datadown = 0 ) do={
}