Skip to main content
Solved

Calm Macro Operations

  • April 21, 2021
  • 1 reply
  • 235 views

  • Voyager
  • 2 replies

Does any one know the syntax to get the first 3 characters of the project name ?  The documentation is not clear.  It talks about support for slicing for strings. For example, @@{foo[3:6]}@@, but it doesn’t seem to work.

Best answer by JoseNutanix

Hi BCar,

Thanks for pointing this out. A ticket has been filed to fix this. In the interim you could use the following workaround:

  1. Create a pre-create task type Set Variable - EScript
  2. As code
    project_name='@@{calm_project_name}@@'
    print('PROJECT_NAME={}'.format(project_name[3:6])) # slice here

     

  3. Output PROJECT_NAME
  4. Use @@{PROJECT_NAME}@@ instead of @@{calm_project_name}@@ for naming convention
This topic has been closed for replies.

1 reply

JoseNutanix
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 102 replies
  • Answer
  • April 22, 2021

Hi BCar,

Thanks for pointing this out. A ticket has been filed to fix this. In the interim you could use the following workaround:

  1. Create a pre-create task type Set Variable - EScript
  2. As code
    project_name='@@{calm_project_name}@@'
    print('PROJECT_NAME={}'.format(project_name[3:6])) # slice here

     

  3. Output PROJECT_NAME
  4. Use @@{PROJECT_NAME}@@ instead of @@{calm_project_name}@@ for naming convention