Newbie Bewilderment: concatenating a literal to a string

Last post 10-26-2015, 5:03 PM by dplaflamme. 6 replies.
Sort Posts: Previous Next
  • Newbie Bewilderment: concatenating a literal to a string
    Posted: 10-26-2015, 3:48 PM

    I'm writing a workflow to accept, among other things, a character string that will be the basis for naming some storage policies. If the user inputs "et1234", I wish to create strings of "et1234a," "et1234b," and "et1234c".

    I've tried using a java script stage to define three new Java variables using the "+" operator for concatenation, but the new variables don't seem visible to later stages.

    I've tried using "+" in the "Workflow Variables" tab of "AssignValues", but I can't find any sign that this is working, either.

    It's a safe bet that my problems stem from my lack of experience with Java and my lack of experience with visual tools like the Workflow editor, but regardless of why, I need to get past this stage so I can get to more interesting errors!

    Help? What's the canonical way to append a literal to a string in a workflow?

    Thanks,

    Nick

  • Re: Newbie Bewilderment: concatenating a literal to a string
    Posted: 10-26-2015, 4:10 PM

    Hi Nick,

    are you trying to create stroage policies? another option might be to use the XML files we have and we can use these in the workflow to pass in the selected variables.

     

    http://documentation.commvault.com/commvault/v10/article?p=features/storage_policies/storage_policy_xml_files.htm#Creating_A_Storage_Policy

    do you have a copy of the workflow that you can attach?

     


    Gary Seibak
    Technical Account Manager - Commvault
  • Re: Newbie Bewilderment: concatenating a literal to a string
    Posted: 10-26-2015, 4:36 PM

    Yes, I'm trying to create storage policies.

    I'm familiar with XML files, but several people at CommVault have tried to convince me that Workflow Engine is the way to go. So, I'm trying to use it instead of, say, learning PowerShell so I can drive XML transactions from some other scripting facility.

    As for attaching a copy of the XML, I'm trying to keep the discussion generic rather than get into conversations about why my XML looks the way it does. I might eventually, if no one can answer my question as posed, but right now I'm trying to learn about the tool, not focus on this particular effort.

  • Re: Newbie Bewilderment: concatenating a literal to a string
    Posted: 10-26-2015, 4:44 PM

    you cut&paste the XML into the workflow to leverage the XML files. then we can modify the variables and pass in what we want into the XML as it runs.

     

    we should probably have a webex on Friday if you have time. Just let me know if that works.


    Gary Seibak
    Technical Account Manager - Commvault
  • Re: Newbie Bewilderment: concatenating a literal to a string
    Posted: 10-26-2015, 4:49 PM

    Can you elaborate on, "modify the variables," please?

  • Re: Newbie Bewilderment: concatenating a literal to a string
    Posted: 10-26-2015, 4:55 PM

    You can use these operators in the AssignValues activity but you'll need to wrap it in java:{}:java tags.  So for example you were updating a variable or input named storagePolicyName, you could do this in the Value column for that variable/input

    java:{xpath:{/workflow/inputs/storagePolicyName} + "a"}

    Also since the workflow engine does handle string concatenation as well you can also just do this in the Value column:

    xpath:{/workflow/inputs/storagePolicyName}a

    Another method is to do this all in a Script activity if you needed to programmatically figure out what to suffix the name with.  To update a variable/input in script, you can do:

    String suffix = "a";
    workflow.setVariable("storagePolicyName",  workflow.getVariable("storagePolicyName") + suffix);
    workflow.setInput("storagePolicyName",  workflow.getInput("storagePolicyName") + suffix);

     

  • Re: Newbie Bewilderment: concatenating a literal to a string
    Posted: 10-26-2015, 5:03 PM

    Ah, I was making it too complicated in the Value columns. Or not complete if I wanted to use Java syntax.

    This looks like fixing is will be pleasantly easy. Thanks!

The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Close
Copyright © 2019 Commvault | All Rights Reserved. | Legal | Privacy Policy