Manii_K
(Manii K)
April 22, 2025, 6:37pm
1
Hi All,
I have 2 DT as DT1 and DT2, It has Column Region and Unit, If DT1 Region is empty it has to fill the fill the region with the help of Dt2 by Using the Column Unit Using Linq attached sample below
DT1
DT2
Region
Unit
Region
Unit
US
US371
US
US371
India
US943
US
US943
Australia
US528
US
US528
US715
US
US890
UK
US890
Europe
US715
Output DT
Region
Unit
US
US371
India
US943
Australia
US528
Europe
US715
UK
US890
Thanks in advance
pikorpa
(Piotr Kołakowski)
April 22, 2025, 7:49pm
2
Hey @Manii_K
Please try this project:
BlankProcess22.zip (35.1 KB)
You can also use this example of linq:
(From row In dt1.AsEnumerable()
Let filledRegion = If(String.IsNullOrWhiteSpace(row("Region").ToString.Trim),
dt2.AsEnumerable().
Where(Function(r2) r2("Unit").ToString = row("Unit").ToString).
Select(Function(r2) r2("Region").ToString).
FirstOrDefault(),
row("Region").ToString)
Select outputDT.Rows.Add({filledRegion, row("Unit").ToString})
).CopyToDataTable()
2 Likes
Anil_G
(Anil Gorthi)
April 23, 2025, 4:39am
3
@Manii_K
Use invoke code activity and send dt1 as in/out and dt2 as in arguments
Dt1.AsEnumerable.
Where(function(x) string.IsNullOrEmpty(x(0).ToString)).
ForEach(sub(x) x(0) =dt2.AsEnumerable.
where(function(y) y(1).ToString.Equals(x(1).ToString).
Select(function(y) y(0).ToString).First)
Cheers
Manii_K
(Manii K)
April 23, 2025, 4:20pm
6
Hi @pikorpa Thanks for your time
1 Like
Manii_K
(Manii K)
April 23, 2025, 4:20pm
7
Hi @Anil_G Thank you so much
1 Like