Fill Data table empty cell with last filled cell in column

My input table looks like this

Section data1
a
13
11
b
110
c
11
What I want my output to look like is this
Section data1
a 13
a 11
b 110
c 11

I can not use the UiPath for each activity because I have to much data for a reasonable run time. I have been tiring to use LINQ like this

(From d In DT_Elevated.asEnumerable()
If (not(string.IsNullorEmpty(d(0))),Let Section = d(0) )
Let ra = d.ItemArray
Let ra(0) = Section
Select DT_sig.Rows.Add(ra)).CopyToDataTable

Hi,

Can you try the following expression?

dt = dt.AsEnumerable.Select(Function(r,i) dt.Clone.LoadDataRow({dt.AsEnumerable.Where(Function(r2,i2) i2<=i andAlso not String.IsNullOrEmpty(r2(0).ToString)).Last.Item(0).Tostring,r(1)},False)).Where(Function(r) not String.IsNullOrEmpty(r(1).ToString)).CopyToDataTable()

Regards,

Hi @David_Ellis,

Maybe you could try with a For Each Row Activity as it is performing a Simple Update with an If Condition Activity. The Implementation would be something in the below manner, assuming that the first column first value will not be empty.
image

We also apply Filter Datatable Activity to remove the rows which have the data1 column values empty.

Visuals :
Input :
image

Output :
image

Let us know if the For Each Row does take a longer time or it doesn’t get the output in the expected manner.

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