Trouble Using A Multiline Input With A ForEach

Last post 01-18-2019, 3:09 PM by ianbert. 2 replies.
Sort Posts: Previous Next
  • Trouble Using A Multiline Input With A ForEach
    Posted: 01-17-2019, 3:30 PM

    I have a need to be able to take a multiline input from a user and then use a foreach to start a new backup for each line in the multiline input.  

    I configured the input as a multiline (line is also checked) input named path and then I tried setting the input value of the ForEach to xpath:{/workflow/inputs/path}

    As a test I added a LogEvent to the ForEach loop with the value of xpath:{/workflow/ForEach_1/path}

    The output I get in the Event Viewer is an event with all the lines concatenated together.
    I was expecting to see 3 seperate events (one for each line) of the multline input.

     

  • Re: Trouble Using A Multiline Input With A ForEach
    Posted: 01-18-2019, 9:30 AM

    What you can do is break the mutli line string up into an Array and then the ForEach loop would be able to process each line.

    So to do this you can add a Script activity before the ForEach loop and use a simple split method like

    return xpath:{/workflow/inputs/multilineinput}.split("\\r?\\n");

    Make sure to update the xpath statement here to point to your actual input into the workflow.

    Then in the ForEach activity, point to the output of this script which should allow you to process each line of the string.

    Regards

  • Re: Trouble Using A Multiline Input With A ForEach
    Posted: 01-18-2019, 3:09 PM

    Thanks for the tip.

    I added a script to the front of the ForEach and when it does that step, job goes pending with the error "Invalid return statement"

     


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