The SolarWinds API as really improved over the last few years but I havent converted my SQL scripts for this into them yet. My conditions are simple but this is an example of what you could do:
SET Caption =
WHEN IP_Address LIKE '%.1' THEN NC.City + '-FIREWALL'
WHEN IP_Address LIKE '%.2' THEN N.Sysname
WHEN IP_Address LIKE '%.10' AND Vendor LIKE 'net-snmp' THEN NC.City + '-LINUX VM'
WHEN IP_Address LIKE '%.15' AND Vendor LIKE 'Windows' THEN NC.City + '-' + N.SysName
ELSE IP_Address END
FROM NodesData N
INNER JOIN NodesCustomProperties NC ON NC.NodeID = N.NodeID
WHERE IP_Address LIKE 'IPADDRESSHERE'
For Subnets that meet my where clause, I rename the first IP address I name the Site name + '-FIREWALL', the second IP is usually a network device so I just keep its hostname. Some other devices are sometimes present so I have conditions set up that look for that and if they are there then they name them accordingly. Lastly I use the IP address as a last resort. This is the ELSE statement at the end. Im sure there are more complicated ones but for where I use this, it meets what I need.
Hope this helps.