Filter Datatable: Conversion from string to Int not valid

Hi everyone.

I’m trying to divide a list of 100 row into 3 group 33-33-34.

The condition to attribute to a group is based on the remaining number after dividing by 3. (mod 3)
Leaving the remaining possibilities to 0 ; 1 or 2
Example for the row 77, the remaining is 2 (25*3 + 2).

In the FilterDataTable activity I’m trying to use : CInt(“ColumnName”) mod 3 = 0 ; 1 or 2
But I have the following error : Conversion from string “ColumnName” to type ‘Integer’ is not valid.

Anyone knows how I can make it work?

have a check on using a groupby and retrurn a list of the split datatable.

Assign Activity
LHS: TableList | List(of DataTable)
RHS

(From d  in YourDataTableVar.AsEnumerable
Group d by k=CInt(d(YourColNameOrIndex).toString.Trim) Mod 3 into grp=Group
Select t = grp.CopyToDataTable).toList

Sorry, I’m still in the learning process, I am not sure how to do it.
I tried to assign some extra variables to create some conditions and use the IF activity instead of FilterDT but still not working.

Right now I have the following :
Main.xaml (10.3 KB)

Based on the Excel file:
ClassRoomUiPath.xlsx (13.4 KB)

Variables:

Flow

  • we do group the data with the help of LINQ
  • then we iterate over the table list and using the index output from the for each activity for the sheetname

find starter help here:
Main_V2.xaml (9.3 KB)

Get training help here:

Thank you very much.

I’m gonna learn more about LINQ, it seems to be useful when using RPA.

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