How can I understand this expression in read range activity

There is ‘For Each Row’ activity named ‘For Each - Column Name to Remove from RawDT’ In the file that you can download in below link.

One expression draws me a question.

‘RawDt.Columns.Cast(Of System.Data.DataColumn).Where(Function(s) Not ColumnNameDt.AsEnumerable.Any(Function(c) c(“Column Name”).ToString.Trim.Equals(s.ColumnName.ToString.Trim))).ToArray()’

It’s what it said.

I want to understand this expresstion.

Please tell me what does it mean and how I can practice those expressions.

Thanks for reading.

@user47 This post may help you :slight_smile: ,

1 Like
RawDt.Columns.Cast(Of System.Data.DataColumn)

We prepare the processing of the datacolumns for LINQ with the CAST operator/method

.Where(Function(s) Not ColumnNameDt.AsEnumerable.Any(Function(c) c(“Column Name”).ToString.Trim.Equals(s.ColumnName.ToString.Trim))).ToArray()

We do filter with the WHERE operator / method the datacolumns

The filter expression is about: check for the column “ColumnName” in the datatable: ColumnNameDT the values, if there is any value present as the currend looped ColumnName

The looped ColumnName are taken from the DataColumns which we do loop with the cast and from where we take the columnname with s.ColumnName

Thank you for your advice!
You’re a god of UIPath

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