Lookup Data Table is so confusing - second set of eyes please

Every time I try to use Lookup Data Table I have trouble getting it to work.

This works:

DT_employeeReport.Select("[Empl #] = '" + transactionItem.SpecificContent("Request Submitter").ToString + "'").CopyToDataTable.Rows(0).Item("Employee Email").ToString

So why doesn’t this work?:

image

I always get confused between the usage of the Lookup Column and Target Column so I switched them:

image

Still doesn’t work. No value is returned by the Lookup Data Table, even though the same lookup with dt.Select works fine.

Hey

This is my understanding of the activity.

Activity explanation
Input:
DataTable: insert the relevant dt.
Lookup Value: What you are expecting to find.

Lookup Column - the column you expect to find the value.
Insert the relevant value of the 3 options.

Target Column - This is the column with the value you want to return (assuming you find a result in the Lookup Column). This column could the same as Lookup Column or any other column in the dt.

Output has two scenarios:
No Match found:
CellValue will return “”
RowIndex will return: -1

Match found:
CellValue: the value of the row.
RowIndex: the dt row index.

Below is my understanding of your example in the 1st picture:
Within DT_employeeReport, you are looking up the “Request Submitter” (from TI)

You are looking up the column: “Empl #” but returning the value in “Employee Email”

Can you check the dt in debug mode Locals Panel?

Any help?

Cheers

Steve

I’ve checked the DT in debug, and of course the dt.select expression works fine which proves the value is valid and the datatable has the desired data.

I’m stumped.

Yeah scratching head.

Can you get it working for two different columns?

Hi,

Isn’t there possibility that Trim is affecting it? In the expression of Select method, there is no Trim.

image

Regards,

The Trim happens on the result of the .ToString - but I tried without it and it still doesn’t work. I verified that there are no extra spaces on the values, but I always Trim things just to be sure.

1 Like