How to convert db query results to array List

Last post 04-28-2016, 3:49 PM by cwsunderland. 3 replies.
Sort Posts: Previous Next
  • How to convert db query results to array List
    Posted: 04-26-2016, 6:41 PM

    Hello ,

    I am querying from the database for the list of media agents currently in use and trying to check if one of my media agent is in that list . 

    I am trying to use ExistsInList utility to check , but looks like the results set from database query is not considering as list. Could someone let me know how to convert it into list ? 

  • Re: How to convert db query results to array List
    Posted: 04-28-2016, 12:03 PM

    Hello Uday,

    First create a string list variable.

    Next use a ForEach activity to iterate through each query row.

    Lastly use a AddToList activity within the foreach. THis will add the column value for each row, to the variable string list.



    Depending on your full requirements it could  be simpler to use a Decision.

    First create your query.

    Then create a decision using an expression like this:


    If the client name exists then it follows the true path, if not it follows the false path.

  • Re: How to convert db query results to array List
    Posted: 04-28-2016, 12:58 PM

    yeah I am already using the first method to add them into array. was thinking there is any easy way to covert insted of iterating through all the values in the query . 

  • Re: How to convert db query results to array List
    Posted: 04-28-2016, 3:49 PM

    You can do something like this in Script activity or the OnComplete script of the CommServDBQuery activity your using (this assumes you have a list variable named clients):

    workflow.setVariable("clients", xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[1]});


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