07-04-2018 07:00 AM - edited 07-05-2021 08:48 AM
Hi,
I'm creating a CLI template to setup ip interfaces. For this, I need to add a number to a dropdown value, but Prime is only concating strings
#set ($lastoctett = $networkip + 3) --> if $networkip is 0, $lastocctett is 03 instead of 3, if $networkip is 16, $lastocctett is 163 instead of 19, ...
How can I make Prime handling my dropdownvalue as an integer?
08-08-2018 12:26 AM
I tried $networkip.parseInt($networkip), but I do not get it working - any ideas?
08-09-2018 05:38 AM - edited 08-09-2018 05:44 AM
($lastoctett = $networkip + 3) ???
networkip is not a number but a combination of numbers and dots -> basically this is of type string
you first need to strip in separate octets before you do this
maybe you can refer to $ipaddress.lastoctet ???
or set ($lastoctett.number = $networkip + 3) ???
08-09-2018 05:45 AM
$networkip is the last octett of the network address, e.g 192.168.1.0 /24
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide