Delete data row from data table

datatable
excel
activities

#41

@aksh1yadav Thanks Akash for sharp reply. Its working now :slight_smile:


#42

Hi I have a task in which i have build a data table. Now the is one column Aging (Double) now i have to filter data condition is: if row(“Aging”) is greater than 0.35
then populate data table with these values.
Please help @aksh1yadav @
Mr_JDavey


#43

Hi, question, I tried your solution, but I get an error saying
“‘DataRowCollection’ does not have a public instance method named ‘Remove’ matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod ‘Invoke method’”

I did see you filled in the parameters of the invoke method, but when I do that I get another error, on the item, saying:
“Compiler error(s) encountered processing expression “item”. Option Strict On disallows implicit conversions from ‘Object’ to ‘System.Data.DataRow’.”

As far as I can tell I did everything just like you did it. Do you know of anything I might be overlooking?

Thanks in advance!


#44

According to this page (https://www.uipath.com/kb-articles/how-to-filter-a-data-table), you would type “Aging>0.35” instead of the “[Status]=‘PV’” part in the select method.

Hope that works for you!


#45

You have to change the Datatype of your argument to System.Data.DataRow.

Regards…!!
Aksh


#46

You mean the Datatype of the value in the parameters? Or the datatype of the “item” in the for each loop? Cause they both are datarows allready as far as I know. Item is an item from an array of datarows, and the value is also set as a datarow. It is exactly the same as in your example, but somehow it doesn’t recognize the item as a datarow it seems…


#47

Will you be able to share your sample workflow and screenshot if possible?

REgards…!!
Aksh


#48

I can’t send the workflow because of the client, but it works very similar compared to you example. Here are some screenshots to show the process and the variables.

Thanks in advance!


#49

Change your ForEach TypeArgument to System.Data.DataRow, you’ve left the default Object there.


#50

Aah, yes, that’s it, thanks! :smiley:


#51

Hi everyone i need help with workflow

1.I have one excel file with column name Post Eutran
now i need to read all string under this column.
2.now each string in column i have to check first 3 letter and Sort and Add it under specific column based on Logic sheet.
Like if String.substring(0,3)= ALL then Paste this string Under column akr1e3.

Please help File attached
@Mr_JDavey @aksh1yadav Book1.xlsx (10.9 KB)


#53

I need to select only those rows which match with the value set in variable. How do I put it in Select?
For eg: data.Select("[COLUMN NAME] = {SOME VARIABLE}")
How do I use variable instead of hard coded value?


#54

Hi @shrutika,

strvalue->string variable
strvalue="SOME Value"
data=data.Select("[COLUMN NAME] ='"+strvalue+"'").CopyToDataTable()

Regards, Arivu :slight_smile:


#55

Thank you. Works as expected


#56

Hi,
Is there a way to filter or copy data rows based on Index from a datatable.


#57

HI @niteshvnr,
Try below code

Dt.Select()(Indexvalue).CopyToDataTable()

Regards, Arivu :slight_smile:


#58

Hi,

What about a list of variables?
I have a string of numbers: “21530,22035,22009”
I split them by {","}
so I got a string badList
now I want to pass them into
dataRow dataRemove = dt.select("[Durien] = ‘"+b+"’")

instead of b but badList. I am thinking to use forloop but then the dataRemove value will be updated to select the 22009 rows only right?

I want it to select all the rows that contains 21530,22035,22009. Thanks

testDelete.xlsx (11.7 KB)
deleteInExcel.xaml (19.2 KB)

Edit: I used a nested for each loop and solved it! Thanks


#60

Hi @lavint,

To remove the multiple rows by select condition. It has custom activity called “Remove Data Row Select” From BalaReva.DataTable.Activities. Below you can take more detail .

Regards
Balamurugna.


#61

I like this approach!
If I would like to do the exact same thing, except for replacing the “Status” column name by the index number of the column, what should I change? I have been trying some stuff but it didn’t work unfortunately.


#62

Hi @trabart,

You can apply like this

 dataTable.Select("[" + dataTable.Columns[0].ColumnName + "] = 1") 

Regards
Balamurugan.S