Vlookup 2 datable (fast)?

I want to map data as below.

image

I have two data tables 1 and 2 based on column APSTS , I have to perfom a vlookup and fill column Meaning_Eng in data table1 with column Status Code values of data table 2

Pleasr guide me about it.

map data.xlsx (20.7 KB)

Hi,

How about the following?

Dim dict As Dictionary(Of String,String) 
dict = dtStatus.AsEnumerable.ToDictionary(Function(r) r("Status Code").ToString,Function(r) r("Meaning 2").ToString)
dtDetail.AsEnumerable.ToList().ForEach(
    Sub(r) 
	If dict.ContainsKey(r("APSTS").ToString) Then
        r("Meaning_Eng")=dict(r("APSTS").ToString)
    End If
    End Sub
)

Sample20220403-1.zip (19.1 KB)

Regards,

@Yoichi After I apply from you.
It show error as below.

image

Hi,

Can you share content of $exceptionDetails at Local Panel when the error occurs?

Regards,

@Yoichi $exceptionDetails at Local Panel as below.

RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> RemoteException wrapping System.ArgumentException: Column ‘Meaning_Eng’ does not belong to table .
at System.Data.DataRow.GetDataColumn(String columnName)
at UiPathCodeRunner_01cc0681118a48b683b030b3e859122c._Closure$__1._Lambda$__3(DataRow r)
at System.Collections.Generic.List1.ForEach(Action1 action)
at UiPathCodeRunner_01cc0681118a48b683b030b3e859122c.Run(DataTable& dtDetail,
DataTable dtStatus)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target,
Object arguments,
Signature sig,
Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object parameters,
Object arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr,
Binder binder,
Object parameters,
CultureInfo culture)
at System.RuntimeType.InvokeMember(String name,
BindingFlags bindingFlags,
Binder binder,
Object target,
Object providedArgs,
ParameterModifier modifiers,
CultureInfo culture,
String namedParams)
at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Run(Object args)
at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode,
List1 inArgs, IEnumerable1 imps,
Object args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance,
ActivityExecutor executor,
BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor,
BookmarkManager bookmarkManager,
Location resultLocation)

Hi,

This message shows there is no column named 'Meaning_Eng’ . So can you check column name of your datatable? Then modify it to correct name in the expression, if necessary.

Regards,

1 Like

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