How to match and mapping values in an excel

it is all about requirment definition and sample data

When

contains ACCESS_ADMIN

and

is the input then it looks like we want to search for roles from input in the mapping.

So we split the input roles on ,

(From d in dtMapping.asEnumerable
Where d("App").toString.Trim.Equals(yourAppKeyVar)
Let rls = InputRoleVar.Trim("[]".ToCharArray).Split(","c).Select(Function (x) x.Trim).ToArray
Let wrl = d("Role in website").toString.Trim(" []".ToCharArray).Split(","c).Select(Function (x) x.Trim).ToArray
Where rls.Intersect(wrl).Any()
Select s = d("Role in Record").toString.Trim).FirstOrDefault()

and also recommended to externalize to variables when it is possible

UPD1 - included [ ] trim

UPD2 - fixed based on update from:

1 Like