Billing Script using Simple Queues misbehaving on v5.2

Hi,

I’m very new to Mikrotik routers, but a have a few installed now and slowly trying to getting my head around them. Or maybe not?

I use a modified version of the “Automated Billing Script without User Manager” and it runs perfectly on a RB750 with ROS v4.17. (Why update if it’s not broken?) I recently deployed the same modified script to a RB750GL with ROS v5.2, but the output is not the same as it is on ROS v4.17. I think the following line is the cause, but I don’t know why it does not work properly:

:foreach i in=[/queue simple find comment !=“”] do={
:set content [/queue simple get $i comment]

Am I correct in saying that the first line should check if there is a comment for each iteration in the simple queue array, and then only perform the commands to follow on those queues where it finds comments? In other words, for each simple queue entry, if the comment field is not equal to blank (!=“”), apply the following instruction?

On v4.17, it does just that. I deleted the rest of the script and only added the following lines to it to display the output of my script in the terminal screen:

:put $content
}

On v4.17 it displays only the contents of the comment fields for the simple queues that have comments, the queues with blank comments fields are ignored.
On v5.2 the same script displays the contents of the comment fields for ALL simple queues, regardless of the field being blank. Thus it displays the comments but has blank lines for the queues that have blank comment fields. :confused:

Question is this: do I have the command and use thereof wrong, or is it a problem in ROS v5.2? I don’t just want to update the OS if I don’t have to, the rest of the funtions that I use on the RB750GL work fine.

Any input will greatly appreciated!

Thanks
Jaco

EDIT:

Just tested the script on v5.12, it does exactly what v5.2 does. :frowning:

Same results here… for some reason v5 prints the output regardless. I re-worked the script a bit. This one works for me in both 4.17 and 5.x

:foreach i in=[/queue simple find] do={
	:set content [/queue simple get $i comment];
	if ([:len $content] > 0) do={
		:put $content;
	}
}

Thanks Skot! That works perfectly now. Never thought of using len to check for text in the comments field :smiley: