Read the text data inside the loop

Hi there,

I am new to Uipath, I have a query that how to pass a text file data inside the loop
Example :
Q1 2022
Q4 2021
Q3 2021
Q2 2021
Q1 2021
Q4 2020

I am using the while loop but I am getting Q1 2022 for each time.
So how can I achieve this.?
Thanks in adavnce

Hey @Ping_Pong , So you are reading this data from text file?

You need to store this data in the collection lets say array or list, then only you can iterate through each of them.


  1. Let’s say you saved Read Text File output in outtext variable and it should be of type String.

  2. And then use below expression in Assign activity.

In Left-hand, ArrOutText
In Right-hand, outtext.Split(Environment.NewLine.ToCharArray)

Note: Here, ArrOutText variable is of type Array of String.

  1. And then use For Each Loop activity and pass ArrOutText variable to it.

    For Each item in ArrOutText
    Use Message Box activity and print item.

Hi @lakshman

Thank you sir, its working fine but I am getting empty messages in between quarter data, how can I achieve the item after another item without blanks.


In Assign activity, make right hand side expression as below and then check it once.


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