Good Morning Everyone,
I am trying to delete specific columns in a datatable. This columns all have one thing in common, they contain “URL” in the name.
How can I achieve this?
Thanks for the help ![]()
Good Morning Everyone,
I am trying to delete specific columns in a datatable. This columns all have one thing in common, they contain “URL” in the name.
How can I achieve this?
Thanks for the help ![]()
can you please clear the use case:
OR
Use this LINQ in Invoke Code activity.
Dim columnsToRemove = dt_Input.Columns.Cast(Of DataColumn)().Where(Function(col) col.ColumnName.Contains("URL")).Select(Function(col) col.ColumnName).ToList()
For Each colName In columnsToRemove
dt_Input.Columns.Remove(colName)
Next
Pass your datatable to invoke code as InOut
Thanks,
Ashok ![]()
in that case we can do (essential modelling)
For each Activity - item in YourDataTableVar.Clone.Columns | TyeArgument: DataColumn
Kindly note:
The table is represented below!
The goal is to remove the columns Move URL, Type URL, etc…
I would like to do this without using the filter activity since there are several columns with URL in it.
| ID | Name | Move URL | Type | Type URL | Power | Accuracy | PP |
|---|---|---|---|---|---|---|---|
| 1 | Growl | Growl | Normal | Normal | — | 100% | 40 |
| 7 | Leech Seed | Leech Seed | Grass | Grass | — | 90% | 10 |
| 13 | Vine Whip | Vine Whip | Grass | [Grass](https://bulbapedia.bulbag |
perfect
so we can do as mentioned:
Another option is:
Assign Activity
arrKeepCols | String Array =
yourDataTableVar.Columns.Cast(Of DataColumn).Select(Function (x) x.ColumnName).Where(Function (x) Not x.ToUpper.Contains("URL")).ToArray
assign Activity =
dtCleansed = yourDataTableVar.DefaultView.ToTable(false, arrKeepCols )
we cannot derive the modeling motivations but would doubt it
as we mentioned:
do not use / involve arguments or variables which are not defined or are null
Hello Ashokkarale!
I am trying out your suggestion, although I confess that I don’t understand the code that you suggested ![]()
For that reason, how should I handle this Error message?
@Duarte_Valente
we recommend no to work on multiple approaches in parallel. Just select one implement it, and explore the other options / approaches afterwards also.
About the ambigious problem: use the full Qualifier: System.Data.Datcolumn instead of DataColumn
Thank you very much PPR !
All I had to do was to write currentDataColumn.ColumnName.ToUpper().Contains(“URL”) and the bot worked!
Have a nice day ![]()
Perfect, so lets close topic by marking the solving post as solution:
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum
You didn’t configured properly
Here is working solution.
Excel file.
Test.xlsx (8.6 KB)
Before:

After:

Here is workflow:
URL Columns.xaml (7.7 KB)
Thanks,
Ashok ![]()
I have one question,
In your xaml file, the variable is named dt, but in the Invoke code is dt_input.(…)
Why is that?
Indeed, I didn’t have the out_table variable created! I fix it, but the code is still not working.
Thank you PPR! I will as soon as I manage to figure out Ash suggestion ![]()
Here we are mapping it.
left side is Code variable and right one is Workflow variable.
Thanks,
Ashok ![]()
Thank you so much for you time Ashokkarale!
I am just starting and there is so much I don’t know.
I configured those arguments, but I still get an error. Don’t know what else to do.
Thank you anyways
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.