Lookup DT issue

Hi All,

I wonder if you can advise
I have a DT and variable (I store in variable lets say value TOM JONES)
Im using Lookup Data Table activity and my goal is to find my value in column ‘User’ and have an output from column ‘Role/Responsibility’
I have an issue because in column ‘Users’ I may have several names not only one and my lookup does not work. Once I have only one user name in column ‘User’ then it works fine.
Any suggestion how can I solved it having still several names which are separated by

;Book1.xlsx (9.2 KB)

In a For Each Row activity, read each row into an array:

RowArray = Row.Item(“Users”).Split(Char.Parse(“;”))

Then use the contains method to see if the array contains your name variable. Use and IF activity to do this

IF RowArray.Contains(NameVariable)

1 Like

Try using row(2).ToString.Contains(“TOM JONES”). this will return bool. based on the result, you can manipulate further workflow.
Main.xaml (5.7 KB)

Hi @ronanpeter
Looks like Im closed to my solution.
So I need one more advise
My User name value (I gave example for TOM JONES) is also stored in variable

I have an excel with list of User names.
I use 1 For Each which give me user name one by one
Then inside 1 For Each I put your For Each
Now I wish to store in variable (I suppose it should be array type) information about all roles that specific User hold because I want to then use them, lets say write in Excel cell

I can attach workflow if this is not clear.

So in your For Each loop which searches the Names arrays to see of they contain Tom Jones, if it does, you want to grab the role in column A.

So inside that IF statement you want to create a new list variable to hold all the roles applicable to Tom Jones. Lets call it RolesList

Something like this should do it:

Main.xaml (6.4 KB)

Once you have searched each row for Tom Jones, you will have two variables to work with

NameVariable = “TOM JONES”
RolesList = {ABVS, AV, A, B, H}

It’s up to you how you then use that. Normally you would want to create a dictionary of key-value pairs which holds all the employee names and their roles. Very easy to work with that then, pasting to excel or using it to access for further analysis in your workflow, whatever you need.