List variable in a format of one item per line

Last post 04-28-2016, 3:49 PM by Robert Ridenour. 3 replies.
Sort Posts: Previous Next
  • List variable in a format of one item per line
    Posted: 04-27-2016, 5:17 PM

    Using the built-in "Demo_CheckReadiness" as an example, how can I take a list and have it show as one item per line vs a comma separated list?  In the Readiness workflow, this would be in the email.

    IE:

     

    The following 3 clients have failed on the readiness check.

    [SERVER1, SERVER2, SERVER3]

     

    I would like to have it more like this:

     

    The following 3 clients have failed on the readiness check.

    SERVER1

    SERVER2

    SERVER3

  • Re: List variable in a format of one item per line
    Posted: 04-28-2016, 11:44 AM
    • isle is not online. Last active: 06-04-2019, 3:28 PM isle
    • Top 25 Contributor
    • Joined on 08-21-2012
    • NJ
    • Adept
    • Points 308

    I believe you would need to use a script before the email function calls the xpath as jquery doesnt work to do new line or replace commands

  • Re: List variable in a format of one item per line
    Posted: 04-28-2016, 11:48 AM
    If you know java you can manipulate this with a oncomplete script in source activity.

    Or use powershell...create an ExecuteScript activity and you can use the below script to format the output:

    ###############################

    $clients = "[client1,client2,client3]"
    $a = $clients -replace '\[','' -replace '\]', '' -replace ',',"`n"

    Write-Host -NoNewline $a

    ###############################
    Note: use the xpath expression for the $clients variable.

    The result looks like this which would be available as an output for that activity.
    client1
    client2
    client3

    Depending on your environment, you may need to pass the following argument to the activity to allow the script to run:
    -ExecutionPolicy Bypass
     
  • Re: List variable in a format of one item per line
    Posted: 04-28-2016, 3:49 PM

    How can I sort the list as well?

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