The Dude function string_compare string_size string_find

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.

Hi All,
Do you have any idea?

Thx

Type it like this:

[string_size(Interface.Name)]

In other cases, try different wildcards in the same way