Counting how many times a word apears in data table

Hey all,

I have hit a bit of a wall. I have a variable that is a data table and I need to count how many times the word “week” appears in it. What is a proper expression for this?

Thanks!

@jamills

Welcome to the uipath community.

If it is in one particular column then you can try below expression.

          Int Count = varDT.Select("[ColumnName] = 'word' ").CopyToDataTable.Rows.count

If you are searching that word in entire Datatable then try this.

  1. Use Output Datatable activity to convert Datatable into string and say ‘varStr’

  2. And then try below expression.

           Int Count = varStr.Split("word"c).Length - 1
    
6 Likes

Hi How about per row? I need to get the least row a word appear

may we ask you to open a new ticket along with sample data and expected output? So we can address it more individually.

The origin topic has some open interpretations and maybe different approaches are matching as well