Get Check Consecutive Text "abc" Count of a Column in DataTable

Can someone please help - If we have a DataTable and in that a column say “X” could have multiple same values/Text i.e “abc” so i need to check if Count of consecutive text “abc” reached more than 20 then we will print the Count

Hi

Welcome to UiPath forum

Hope these steps would help you resolve this

—use a excel application scope and pass the filepath as input
—inside the scope use a read range activity and get the output as dt

—now use a assign activity like this

dt = dt.AsEnumerable().Where(Function(a) a.Field(of String)(“yourcolumnname”).ToString.Contains(“abc”)).CopyToDatatable()

This dt will have only the rows of a column having abc in it

To get the count

dt_count = dt.Rows.Count

Where dt_count is a variable of type int32

Cheers @NewBee1

1 Like

Thanks @Palaniyappan , But i need to check for text “abc” only if they are occuring CONSECUTIVELY in rows . But if they are not occuring consecutively i dont need its count .

Can I have an example of such text
@NewBee1

Yes, @Palaniyappan

Column_X :
abc
xyz
bs
abc
nz
old
abc
ghf
ols
abc
abc
abc
abc
abc
abc
abc

So i need the count =7 as text “abc” is occuring consecutively at the end.