Re: Convert comma separated list to new variables (375 Views)
Reply
Trusted Contributor
Posts: 218
Registered: ‎07-29-2010
Message 1 of 5 (411 Views)
Accepted Solution

Convert comma separated list to new variables

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

 

Trusted Contributor
Posts: 218
Registered: ‎07-29-2010
Message 2 of 5 (410 Views)

Re: Convert comma separated list to new variables

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
Valued Contributor
Posts: 95
Registered: ‎07-19-2012
Message 3 of 5 (400 Views)

Re: Convert comma separated list to new variables

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.

Honored Contributor
Posts: 1,573
Registered: ‎05-21-2008
Message 4 of 5 (397 Views)

Re: Convert comma separated list to new variables

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
http://www.mahmoudthoughts.com
  • 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.
  • Trusted Contributor
    Posts: 89
    Registered: ‎10-01-2012
    Message 5 of 5 (375 Views)

    Re: Convert comma separated list to new variables

    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.

    The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.