How to add new string values to same variable

Hi iam looping web pages and getting string values using GET TEXT.

Now i have to save all the values in a list variable later ill be looping that and pull the values one by one. But here iam struck with saving he values to that list variable.

Thanks in advance.

@jai_kumar2
check this
Add Collection Activity

Hi @jai_kumar2

Use the Append items to list activity to add the values in to the list.
You can store the Get text in an variable and pass the variable to the Item to append to append field in the activity. In List give the List variable that you are created.
image

Hope it helps!!

Hi @jai_kumar2

Try this

  • Assign
    • To: stringList
    • Value: New List(Of String)()
  • For Each (your loop)
    • Assign
      • To: yourStringValue
      • Value: (Get Text activity to obtain the string value)
    • Assign
      • To: stringList
      • Value: stringList.Add(yourStringValue)

I hope it helps!!

Thanks for the reply

Main.xaml (12.7 KB)

in my workflow iam getting the last value from the variable

  * Assign
  * To: stringList
  * Value: stringList.Add(yourStringValue)

You shouldn’t be using Assign here, you should be using Add to Collection (Append Item to Collection depending upon version)

In the xaml you have created the list inside the for each loop which is iterating array variable right.
For every iteration it will create a new list then old data in the list deleted.
Give the assign which is used to create a new list before the for each loop.

Change the assign activity before the For each loop
image

Hope it helps!!

Yes i made the changes but still getting the last value only

Hi @jai_kumar2

Output:
image

Check below xaml

Main (15).xaml (13.6 KB)

@jai_kumar2

You store the list items in Listofitem so, you have to give same list in For each also then you got the output.

@jai_kumar2

did you try this?

If you got the solution for your issue. Please mark it as solution to close the loop and others also helped.

Regards,

Its working for me fine @jai_kumar2

Have you replaced the assign activity which using for initializing the list before the for each loop.
Check it once and let me know.

Happy Automation!!

Thank you all for the support :handshake:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.