Absent Member.. DBR Absent Member..
Absent Member..
828 views

Convert comma separated list to new variables

Jump to solution

I have a comma separated list of values (5) that I want to convert each value to a new variable or be able to pull the values out to use elsewhere.

 

What is the best way to accomplish this?

 

Thanks,

Don

 

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Convert comma separated list to new variables

Jump to solution

Hi,

 

For me, if I want to extract the value, I will use result tab, and define new variable using table filter and use comma as my separator and specify the column number X to get the value  I want.

 

Regards,
Mahmoud Ibrahim
https://www.itmthoughts.com
New version of Mahmoudthoughts witten by other IT experts
  • Say thanks by clicking the "Kudos! Star" which is on the left.

  • Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue.
  • 4 Replies
    Absent Member.. DBR Absent Member..
    Absent Member..

    Re: Convert comma separated list to new variables

    Jump to solution
    This is the list
    2012-03-28T11:00:00+00:00,2012-03-31T11:05:00+00:00,Task In Progress,2012-03-28T11:05:00+00:00,2012-03-31T11:00:00+00:00
    0 Likes
    jadda Absent Member.
    Absent Member.

    Re: Convert comma separated list to new variables

    Jump to solution

    1. Put them in a list ,retrive back using 'List Item Grabber',which is located in Utility operations.This is best choice.

     

    2.Put them in Selection list , u can select any one at runtime.

     

    3. Put them in Database  and retrive back using  SQL Query.

    0 Likes
    Micro Focus Expert
    Micro Focus Expert

    Re: Convert comma separated list to new variables

    Jump to solution

    Hi,

     

    For me, if I want to extract the value, I will use result tab, and define new variable using table filter and use comma as my separator and specify the column number X to get the value  I want.

     

    Regards,
    Mahmoud Ibrahim
    https://www.itmthoughts.com
    New version of Mahmoudthoughts witten by other IT experts
  • Say thanks by clicking the "Kudos! Star" which is on the left.

  • Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue.
  • Absent Member.. Steve_Drummond Absent Member..
    Absent Member..

    Re: Convert comma separated list to new variables

    Jump to solution

    This solution works fine except if he wants to put each into a seperate variable then he needs 5 results and is required to set up the filter on each one.

     

    Two other solutions both involve scriplets. If you don't mind that the variable names would just be incremented then you could use:

     

    arrValues = scriptletInput.split(",");
    for(var i = 0; i < arrValues.length; i++) {
      scriptletContext.put("myVarName" + i, arrValues[i]);
    }

     If you needed to name the variables more appropriately then if you had a header seperated list as well you could add that in very easily.

    0 Likes
    The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.