IT Process Automation

 View Only
  • 1.  Searching ValueMap Values

    Posted Jun 05, 2017 03:09 PM

    Hello,

     

     

    I have a value map 'Process.ActiveGroups' array with two attributes:

    • Group_Name
    • Group_Handle

     

    Actually it has more then 500 itens on that and i want to search a specific item inside the value map.

     

    Is this possible? I tried to use find() JS function like:

    Process.ActiveGroups.find(x => x.Group_Name === 'GROUP NAME').Group_Handle

    but the code was not accepted.

     

    Any tips about that? I search the KB and communities and did not found anything about search inside the value map.

     

    Thank you!



  • 2.  Re: Searching ValueMap Values

    Broadcom Employee
    Posted Jun 09, 2017 04:58 PM

    What type of error did this give?  It may be that if find is a javascript function, you may need to convert the valuemap to a javascript object first.  Here is a function that does that:

     

    ca_pam_convertToJavaScriptObject(valueObject) - CA Process Automation - 4.2.2 - CA Technologies Documentation 



  • 3.  Re: Searching ValueMap Values
    Best Answer

    Posted Jun 09, 2017 06:42 PM

    One option that isn't elegant but is fairly reliable is using a string.match:

     

     

    for (m=0; m<Process.ActiveGroups.length;m++){

     

    if(Process.FormVM[m].Group_Name.match(Process.GROUP NAME)){
    Process.GrpHandle =Process.FormVM[m].Group_Handle;
    }

    }

     

    If you have multiple groups to retrieve, and they are in an array, you can do an outer for(); loop over the original array, and return the handles into an array as well (via an Array.push operation, etc).