Subscribe
Accepted Solution

Truncating variable names

I want to leverage the volume name provided by the customer to build a qtree inside the volume. I can see how to concatenate one variable name into another but I can't think how to truncate one. For example say the user provides the $volume = MyNewVol_Prod

and want to create a Qtree called "MyNewVol_Qtree". That is, truncate part of the volume name to create the QTree name...

Re: Truncating variable names

There is an included function called splitByDelimeter.  This will give you the ability to parse the volume name and then return the part that you want.  In the example that you gave it would be: splitByDelimeter($VolumeName,"_",0)

Alternately, you could devise a VolumePrefix method and have that as a separate variable which would be combined with a type.  I use this method to ensure naming conventions are adhered to when provisioning for applications.  For example, if I am provisioning a data volume then the volumePrefix might be "goodrum_application" but the actual volume name is "goodrum_application_data" ($volumePrefix + "_data").  Using this method would allow you to create a Qtree named "goodrum_application_qtree" ($volumePrefix + "_qtree")

Jeremy Goodrum, NetApp

The Pirate

Twitter: @virtpirate

Blog: www.virtpirate.com

Re: Truncating variable names

Awesome...Wow that was easy...