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?



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