How can i print a user input multiple times using ForEach activity

Last post 04-03-2017, 4:18 PM by cwsunderland. 1 replies.
Sort Posts: Previous Next
  • How can i print a user input multiple times using ForEach activity
    Posted: 04-03-2017, 3:26 PM

    I want to take an input from an user and print it multiple times. For ex: -User provides his name as input, i want it to be displayed 5 times. Where do i define this 5 on the properties of ForEach ?

  • Re: How can i print a user input multiple times using ForEach activity
    Posted: 04-03-2017, 4:18 PM

    The ForEach activity iterates through a list but you can use it to loop for a certain number by creating a list of N number of items.  If it's a static number for every execution (i.e. 5) then you can just do something like this in the values input of the ForEach activity:

    java:{return new Integer[] {1,2,3,4,5}}:java

    This of course can really be a list of anything, like five 0's or five empty strings as long as the size of the list is the number of loops you require.

    If this is a dynamic loop value, you can add a Script activity before the ForEach activity and do something like:

    List l = new ArrayList();
    for (int i=0;i<xpath:{/workflow/variables/loopsize};i++) {
    return l;

    Then set the values input of the ForEach to the output of this Script.

    Let me know if you have any issues with this.


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