what i do wrong

hi, im trying simple script but cant get it working


:local txbyte 
:set txbyte [ /interface ethernet get value-name=driver-tx-byte ether1]
:if ($txbyte > 50000) do = 
 {
/interface ethernet reset-counters ether1
	}



Script Error: cannot compare if nothing is more than time interval

i checked varible by :put $txbyte the :set is working fine problem in IF statement, so can anyone plz tell me what i did wrong?

Some investigation shows that the output of your command do have spaces.

“1234” bytes shows as “1 234”
http://forum.mikrotik.com/t/tx-bytes-rx-bytes-have-spaces-and-are-unusable-please-help-edited-and-added-more-info/109490/1

I have cleaned up the script in that thread some. Cut and past this to command line. (to create a function)

:global removeSpace do={
	:local temp
	:for i from=0 to=([:len $t] - 1) do={
		:local char [:pick $t $i]
		:if ($char = " ") do={
			:set $char ""
		}
		:set temp ($temp . $char)
	}
	:return $temp
}

Then change your script to some like this:

:local txbyte 
:set txbyte [$removeSpace t=[:tostr [/interface ethernet get ether1 value-name=driver-rx-byte ]]]
:if ($txbyte > 50000) do={
	/interface ethernet reset-counters ether1
}

thanks for your help, but i did not get your code runing, i fix it by

:local removeSpace do={ :local temp;
    :for i from=0 to=([:len $t] - 1) do={ :local char [:pick $t $i];
        :if ($char = " ") do={ :set $char ""; }
        :set temp ($temp . $char); }
    :return $temp; }

:put [$removeSpace t=[:tostr [/interface ethernet get value-name=driver-tx-byte ether1]]]

:local txbyte 
:set txbyte [$removeSpace t=[:tostr [/interface ethernet get value-name=driver-tx-byte ether1]]]

:if ($txbyte > 50000) do={
	/interface ethernet reset-counters ether1
:put [/interface ethernet get value-name=driver-tx-byte ether1] 
}

works like charm , ty