Hello,
i will post the leases to a webserver and ich must encode the string but len return always 1 with the following command:
:put [:len [/ip dhcp-server lease print as-value]]
Maybe someone has a solution?
best regards
Heiko
{
:local test 0
:foreach i in=[/ip dhcp-server lease find] do={
:set $test ($test+1)
}
:put $test
}
put [len [tostr [/ip dhcp-server lease print as-value]]]
put [tostr [/ip dhcp-server lease print as-value]]
{
local string
foreach item in=[/ip dhcp-server lease print as-value] do={
set string ($string.($item->"mac-address").",")
}
#snip that last trailing comma
set string [pick $string 0 ([len $string]-1)]
put [len $string]
put $string
}
/ip dhcp-server lease
{
:local string ""
:foreach item in=[print as-value] do={
:set $string "$string$($item->"mac-address"),"
}
# snip that last trailing comma
:set $string [:pick $string 0 ([:len $string] - 1)]
:put [:len $string]
:put $string
}
/ip dhcp-server lease
{
:local string ""
:foreach item in=[find] do={
:set $string "$string,$[get $item mac-address]"
}
# snip first trailing comma
:set $string [:pick $string 1 [:len $string]]
:put [:len $string]
:put $string
}
Thanks....As @rextended pointed out some time back:
Code: Select all{ :local test 0 :foreach i in=[/ip dhcp-server lease find] do={ :set $test ($test+1) } :put $test }
:put [:len [/ip dhcp-server lease find]]
Hello,
i will post the leases to a webserver and ich must encode the string but len return always 1 with the following command:
:put [:len [/ip dhcp-server lease print as-value]]
Maybe someone has a solution?
best regards
Heiko
:put [:len [:tostr [/ip dhcp-server lease print as-value] ] ]
/ip dhcp-server
:foreach i in=[find] do={
:local name [get $i name]
:local number [:len [lease find where server=$name]]
:put "scope=$name leases=$number"
}