Community discussions

MikroTik App
 
AnAnAs
newbie
Topic Author
Posts: 25
Joined: Fri Apr 13, 2018 11:08 pm
Location: France

The Dude function string_compare string_size string_find

Thu Apr 23, 2020 3:06 pm

Hi All,

I would like to use the string functions to make filters in my label.
I would like to do that, but I am almost sure that it is not possible, because I am in a ros_command

[Interface.Name]: [ros_command(":put ([interface ethernet monitor [Interface.Name] once as-value]->\"sfp-vendor-part-number\")")]

So, I would like to do it with "if" functions,
if [Interface.Name]=sfpplus1 then ros_command.... with sfpplus1
if [Interface.Name]=sfpplus2 then ros_command.... with sfpplus2
if [Interface.Name]=sfpplus3 then ros_command.... with sfpplus3

But I'm already stuck,
because none of my tests with the string functions work.
I have listed below, from 1 to 10
I also read on this forum, I have the impression that this problem has lasted for 10 years ...

[snmp_wireless_link_info()]Rx: [Interface.InBitRate][snmp_wireless_link_rx_rate()]
Tx: [Interface.OutBitRate][snmp_wireless_link_tx_rate()]

[Interface.Name]: [ros_command(":put ([interface ethernet monitor sfpplus1 once as-value]->\"sfp-vendor-part-number\")")]

0-- [Interface.Name]
1-- [string_size("[Interface.Name]")]  # not working
2-- [string_size([Interface.Name])]   # not working

3-- [if("[Interface.Name]"="sfpplus1","OK","NOK")]  # return alawys ok, why ?
4-- [if([Interface.Name]="sfpplus1","OK","NOK")]
5-- [if([Interface.Name]=sfpplus1,"OK","NOK")]

6-- [string_compare("[Interface.Name]","sfpplus1")]  # work like size ? why?
7-- [string_compare([Interface.Name],sfpplus1)]
8-- [string_compare("azerty","azerty")]   # Why doesnt return 0

9-- [string_find("azerty","azerty")]  # work like compare
10-- [string_find([Interface.Name],[Interface.Name])]  #not working
1.PNG



Thanks for your help.
You do not have the required permissions to view the files attached to this post.
 
AnAnAs
newbie
Topic Author
Posts: 25
Joined: Fri Apr 13, 2018 11:08 pm
Location: France

Re: The Dude function string_compare string_size string_find

Tue Apr 28, 2020 6:19 pm

Hi All,
Do you have any idea?

Thx
 
KeeperVolok
just joined
Posts: 1
Joined: Fri Nov 25, 2022 9:50 am

Re: The Dude function string_compare string_size string_find

Fri Nov 25, 2022 9:57 am

1-- [string_size("[Interface.Name]")]  # not working
2-- [string_size([Interface.Name])]   # not working
Type it like this:
[string_size(Interface.Name)]

In other cases, try different wildcards in the same way

Who is online

Users browsing this forum: No registered users and 9 guests