Error while running Basic DataTable Example using DataRow, Select and for each loop

Hello Everyone, I am actually trying with Basic Demo of UiPath Academy Level 1 Lesson 3 Data Manipulation which fetchs Employee Record based on Age and Income using DataTable and Select. I actually want to filter record on basis of Age and Income of Employee, I am using DataTable, DataRow, Select and For each Loop. But Actually I have tried with many options in Write Line. But still I am getting various validation errors in Write Line in for each activity. Error such as “Compiler error(s) encountered processing expression “dataTableRow().Item(“Name”)”.
Number of indices is less than the number of dimensions of the indexed array.”. I am attaching Screenshot and Json and Xml of Process. Please anyone help me fix this Issue, as Early as possible.

Hi @RohitSuperCool009

I have looked at your solution. And it looks like the way you are trying to write into the Write Line activity is wrong. When you are writing into a value within a for each row activity, you should specify the column name in the below format

For Each 
 Row of DataTable


Or else, instead of using the column name, you can include the column index. So the way you have tried is not going to work there :slight_smile:

In case you want to write the content of a particular row of a datatable without looping, below approach is what you have to take


This will get the result of the 0th row and of column you specified and write it in the console.

And for data table filtering, you have to use the Select function which is done like this.

Dt_Data.Select("[Age] < 40 AND [Income] > '40K'")

Check out the sample xaml file to get an idea on how it is done…

DataTableSelect.xaml (7.0 KB)

Please mark the answer as the solution if this works out for you so it could benefit others as well :slight_smile:


Thanks Lahiru! The Solution that you provided to me. I worked for me. I was able to run the DemoDataManipulationProcess using DataTable without any Errors. As You suggested I changed the Process and the Process was working without any issue. Thanks a lot friend for suggesting proper solution to my issue.

1 Like

Cool bro @RohitSuperCool009 ! Glad to hear I was able to help you with it… Could you also mark my answer as the solution so it could benefit others as well? :slight_smile:

Thanks friend!!

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