My sample code doesn't work although it is excatly same as the academy sample code

Hi community friends. I am trying to run a simple working with data types code based on the academy lesson but 'sorting data table ’ activity doesn’t work properly although it is exactly the same as the sample code in the lesson. Can you please let me know why?
I have attached my code below
Main.xaml (14.6 KB)
This one is the code I downloaded from UiPath academy
Demo - Working with DataTables.zip (63.3 KB)
Thanks in advance

Hi Aida,

When you join the data tables, the ID column names becomes “ID” and “ID_1”. You removed the column “ID” from BorrowedBooks, but later you tried to sort on the same column name, which doesn’t exist. In order to resolve this, either remove the column “ID_1”, or use "“ID_1” to sort the table

Thank you so much

Worked now. My question is how come I couldn’t see it in the sample file in academy? I mean I did exactly step by step same but in no step I notices this name change!

Hi @Aida_Azar, in the example, the column index 6 was used to remove the column, but you use the column name “ID” (column ID 3) instead of column index.

1 Like

Sorry for silly questions. But how would I know that the index is 6?

Not a silly question. These are the column names after merging.

BookTitle,Author,BookID,ID,LastName,FirstName,ID_1,Department,Phone

Column index starts from 0, index for ID is 3 (4th column), index for ID_1 is 6 (7th column)

Hope that helps

1 Like

Thank you so much for your patience in clarifying the matter :slight_smile:

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