Community discussions

MikroTik App
 
benk
just joined
Topic Author
Posts: 4
Joined: Thu Apr 16, 2009 7:18 am

Device Property/Variable request (Obvious request)

Wed Aug 19, 2009 8:32 am

I Want to get the second address of a device via variable.
EG:
You already have [Device.FirstAddress]

Why not a:
[Device.SecondAddress]

Thought this one was a bit obvious.
 
fbsdmon
newbie
Posts: 29
Joined: Thu Dec 29, 2011 11:37 pm

Re: Device Property/Variable request (Obvious request)

Sat Mar 17, 2012 11:00 pm

Challenge accepted!

Function
Name: Device.SecconAddres:
Code:
string_substring(
  string_substring(
    device_property("AddressesCommaList"), 
    string_find(
      device_property("AddressesCommaList"), 
      ","
    )+2
  ),
  0,
  string_find(
    string_substring(
      device_property("AddressesCommaList"), 
      string_find(
        device_property("AddressesCommaList"), 
        ","
      )+2
    ),
    ","
  )
)
 
User avatar
dazm
just joined
Posts: 21
Joined: Mon Oct 03, 2011 5:09 am
Location: Russia

Re: Device Property/Variable request (Obvious request)

Tue Jan 29, 2013 2:58 pm

Function
Name: Device3Address:
string_substring(
string_substring(
      string_substring(
        device_property("AddressesCommaList"),
        string_find(
          device_property("AddressesCommaList"),
          ","
        )+2
      ),
	  string_find(
        (string_substring(
           device_property("AddressesCommaList"),
           string_find(
             device_property("AddressesCommaList"),
             ","
           )+2
         )
		),
        ","
      )+2
    ),
	0,
	string_find(
	  string_substring(
        string_substring(
          device_property("AddressesCommaList"),
          string_find(
            device_property("AddressesCommaList"),
            ","
          )+2
        ),
	    string_find(
          (string_substring(
             device_property("AddressesCommaList"),
             string_find(
               device_property("AddressesCommaList"),
               ","
             )+2
           )
		  ),
          ","
        )+2
      ),
    ","
	)
)
)
p.s. but this is not a universal function
 
User avatar
dazm
just joined
Posts: 21
Joined: Mon Oct 03, 2011 5:09 am
Location: Russia

Re: Device Property/Variable request (Obvious request)

Tue Jun 04, 2013 12:56 pm

Device4Address
string_substring(
string_substring(
    string_substring(
      string_substring(
        device_property("AddressesCommaList"),
        string_find(
          device_property("AddressesCommaList"),
          ","
        )+2
      ),
	  string_find(
        (string_substring(
           device_property("AddressesCommaList"),
           string_find(
             device_property("AddressesCommaList"),
             ","
           )+2
         )
		),
        ","
      )+2
    ),
      string_find(
        (string_substring(
           string_substring(
             device_property("AddressesCommaList"),
             string_find(
               device_property("AddressesCommaList"),
               ","
             )+2
           ),
	     string_find(
           (string_substring(
              device_property("AddressesCommaList"),
              string_find(
                device_property("AddressesCommaList"),
                ","
              )+2
           )
		   ),
           ","
         )+2
         )
		),
        ","
      )+2
  ),
  0,
  string_find(string_substring(
    string_substring(
      string_substring(
        device_property("AddressesCommaList"),
        string_find(
          device_property("AddressesCommaList"),
          ","
        )+2
      ),
	  string_find(
        (string_substring(
           device_property("AddressesCommaList"),
           string_find(
             device_property("AddressesCommaList"),
             ","
           )+2
         )
		),
        ","
      )+2
    ),
      string_find(
        (string_substring(
           string_substring(
             device_property("AddressesCommaList"),
             string_find(
               device_property("AddressesCommaList"),
               ","
             )+2
           ),
	     string_find(
           (string_substring(
              device_property("AddressesCommaList"),
              string_find(
                device_property("AddressesCommaList"),
                ","
              )+2
           )
		   ),
           ","
         )+2
         )
		),
        ","
      )+2
  ),
  ","
  )
)
 
User avatar
dazm
just joined
Posts: 21
Joined: Mon Oct 03, 2011 5:09 am
Location: Russia

Re: Device Property/Variable request (Obvious request)

Tue Jun 04, 2013 12:57 pm

Device5Address
string_substring(
  string_substring(
    string_substring(
      string_substring(
        device_property("AddressesCommaList"),
        string_find(
          device_property("AddressesCommaList"),
          ","
        )+2
      ),
	  string_find(
        (string_substring(
           device_property("AddressesCommaList"),
           string_find(
             device_property("AddressesCommaList"),
             ","
           )+2
         )
		),
        ","
      )+2
    ),
      string_find(
        (string_substring(
           string_substring(
             device_property("AddressesCommaList"),
             string_find(
               device_property("AddressesCommaList"),
               ","
             )+2
           ),
	     string_find(
           (string_substring(
              device_property("AddressesCommaList"),
              string_find(
                device_property("AddressesCommaList"),
                ","
              )+2
           )
		   ),
           ","
         )+2
         )
		),
        ","
      )+2
  ),
  string_find(
    (string_substring(
       string_substring(
         string_substring(
           device_property("AddressesCommaList"),
           string_find(
             device_property("AddressesCommaList"),
             ","
           )+2
         ),
	       string_find(
             (string_substring(
                device_property("AddressesCommaList"),
                string_find(
                   device_property("AddressesCommaList"),
                   ","
                )+2
              )
			 ),
             ","
           )+2
       ),
         string_find(
           (string_substring(
              string_substring(
                device_property("AddressesCommaList"),
                string_find(
                  device_property("AddressesCommaList"),
                  ","
                )+2
              ),
	           string_find(
                 (string_substring(
                    device_property("AddressesCommaList"),
                    string_find(
                      device_property("AddressesCommaList"),
                      ","
                    )+2
                  )
			     ),
                 ","
               )+2
            )
		   ),
           ","
         )+2
     )
	),
    ","
  )+2
)

Who is online

Users browsing this forum: No registered users and 30 guests