Bulk update of a data table column in one go

Hi Team,

Am trying to update a data table column in one go that has huge data by using below assign statement:

Datatable.Columns[“Column”].Expression=“‘********’”

By doing this, it will do bulk update for all the filled cells and blank cells as well for a column.

But the requirement is it should do a bulk update of all the filled cells & not for blank cells.

Any idea how we do this?

1 Like

@MANISHA_V_ARORA - You mean all the filled cells in a particular columns should be replaced with ****** right? Once you confirmed, I can share you the invoke code method…

Yes only the filled cells of a particular column should be filled in one go.

Please note the data can be huge.

@MANISHA_V_ARORA -

Noted… After read range your sheet and store the output as Dt. use the invoke code below…

dt.AsEnumerable().where(function(row) not row("YourColName").ToString.Equals("")).ToList.ForEach(sub(row) row("YourColName") = "********")

Then, Write Range your Results to different sheet and verify the results…

My Sample Input

Output

Please try and let us know…

2 Likes

Thank you for quick reply.

I get below error:

error CS1026: ) expected At line 0
error CS1528: Expected ; or = (cannot specify constructor arguments in declaration) At line 0
error CS1002: ; expected At line 0
error CS1525: Invalid expression term ‘.’ At line 0
error CS1002: ; expected At line 0
error CS1002: ; expected At line 0
error CS1525: Invalid expression term ‘)’ At line 0
error CS1026: ) expected At line 0
error CS1002: ; expected At line 0
error CS1525: Invalid expression term ‘)’ At line 0
error CS1002: ; expected At line 0

@MANISHA_V_ARORA - Did you choose Language as VBNet in the invoke code? Code I provided is VBNet.

My bad :woman_facepalming:

Changed it to VB

Get this error though now:
Invoke code: Exception has been thrown by the target of an invocation.

please check your data. I guess something wrong with the column values…

The data is fine. The column has numeric values.

@MANISHA_V_ARORA - Please share the screenshot of your column values(Sample).

Tried on a column with text value and also on a column with numeric values.
It doesnt work.

Sample here:
column

Code is working fine for me, no issues(Shared the results of the screenshot already). Please share sample data with at least some 50-100 rows(if any variations there) …will try here.,

Here you go:
Test.xlsx (9.6 KB)

@MANISHA_V_ARORA - Just pointed your sheet to read your sheet1 and Changed the column name…works fine here…

Code used:

dt.AsEnumerable().where(Function(row) Not row("c_tier_cd").ToString.Equals("")).ToList.ForEach(Sub(row) row("c_tier_cd") = "********")

Workflow

my project is in C# and not VB.
Does this require any external dependent files to be downloaded?

For me here it doesnt seem to work.

Uipath version is 2020.10.2 on my side

Hmm…this should be first item added in your initial query…

1 Like

You know it what it worked.

Thank you so much :slight_smile:

In arguments I had to pass the dt variable as below:
Which i didnt enter earlier :woman_facepalming: :woman_facepalming:
capture

2 Likes

Omg…I thought you had it since I shared the screenshot of the arguments in my initial post…

But glad to know it worked. :beers:

Please mark my post as solution, that will close this thread and others looking for solved post might easily benefited.

Also wanted to check…what is total # rows you have and what is the execution time ?

1 Like

The sample sheet that I have taken has around 1500 rows of data and it takes
00:00:06 duration

2 Likes

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