I need to get all the corresponding values of “City” against the “Country” in string.
Expected Output- str_Country = “India”, str_City= “Delhi”,“Mumbai”,“Kolkata”,“Chennai”.
I need to get all the corresponding values of “City” against the “Country” in string.
Expected Output- str_Country = “India”, str_City= “Delhi”,“Mumbai”,“Kolkata”,“Chennai”.
Hi
Hope the below steps would help you resolve this
Use a excel application scope and pass the file path as input
Inside the scope use a Read range activity and get the output as dt
Now use a assign activity like this
dt = dt.AsEnumerable().Where(Function(a) a.Field(of String)(“Country”).ToString.Contains(“India”)).CopyToDatatable()
If you want you can pass even as a string variable like this instead of “India”
dt = dt.AsEnumerable().Where(Function(a) a.Field(of String)(“Country”).ToString.Contains(str_country.ToString)).CopyToDatatable()
Now this dt will have only the records with country “India” or the string variable passed as input
Then use a assign activity to get the list of city in it
Str_City = String.Join(“,”,dt.AsEnumerable().Select(Function (a) a.Field(of string)(“City”).ToString).ToArray())
Cheers @mkm8587