updating a processblockvariable

Last post 11-06-2017, 12:05 PM by cwsunderland. 4 replies.
Sort Posts: Previous Next
  • updating a processblockvariable
    Posted: 11-04-2017, 12:52 PM


    I have a workflow with a for-eachXML-block. In that for-each-block, I call a process-block with 3 variables.

    I have to count some passes in it, so I use a variable (unfortionatly a global)
    The workflow runs ok, but only "without concurrent loops" (as they use a global variable)

    I want to use "numberOfParallelExecutions = 3", but tha I need "local variables", what can be accompliched with a (dummy) definition in the process-block

    ==> how do I update such a processblockvariable using a script, because in the assign-activity (the left part),they are not available?

  • Re: updating a processblockvariable
    Posted: 11-06-2017, 9:18 AM

    Process Block local variables are coming in sp10 but until then you can access the current index of the foreach loop and append that to a global variable name so it won't affect variables being accessed in other threads.

    So at the start of the ForEach you can initialize the variable like

    String varName = "MyVar_" + workflow.getParent().getLoopIndex();
    workflow.setVariable(varName, 0);

    And then incremement it inside your passes

    String varName = "MyVar_" + workflow.getParent().getLoopIndex();
    int val = workflow.getVariable(varName);
    workflow.setVariable(varName, val+1);

    Let me know if you run into any issues with this.


  • Re: updating a processblockvariable
    Posted: 11-06-2017, 10:50 AM

    The idea of dynamic creation of 'global' vars is my solution, thanks!

  • Re: updating a processblockvariable
    Posted: 11-06-2017, 11:56 AM

    The only inconvenience is that those variables are not usable outside "scripts", because the "deploy" doesn't know them and blocks on it.

    As bypass I use

    <set lock:workflow.jobid>

    <script:assign loop-level-var to an existing global-level-var>

    <...:use global-level-var>

    <release lock:workflow.jobid>


    and testing

  • Re: updating a processblockvariable
    Posted: 11-06-2017, 12:05 PM

    Are you trying to use an xpath statement to these dynamically created global variables?

    If so you can instead use a java expression to get the value instead of an xpath expression in any activity


    Also there is a way to turn off xpath validation during deployment via a reg key if that is something you are interested in.

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.
Copyright © 2020 Commvault | All Rights Reserved. | Legal | Privacy Policy