Picking row value dynamically with an additional action

Hello people, how are you all

Im stuck at a excel scenario,
So my scenario is as—

Lets say there array of strings with values= A,B,C,D,E,F
& we have a excel file (check the photo to understand)

So Dyanmically any alphabet value is getting pulled

& for that aplhabet

we need extract/retrive its value from “Details” column ( check the photo)
as well as the just following row value of that particular Column

example if D is selected
then we need to get its respected “Details column” value & just below “details” column value as well

Please help

we can do as following:

read in excel into a datatable
remove with wilter datatble all empty rows (e.g. all Details Column)

fill up the Name row as it was done here:
FillUp_BlockBlanks.xaml (8.7 KB)

Later you can just filter on the letter and will get the corresponding details

Umm Man, i think you didnt get my question

accordingto your example
Lets “B” is selected,
then we should be getting output like
1st “4” then another output should be “5”

on begin the sample data looks like:

B1 = A, B2 = B mapping to your case

After filling up it is looking like this:

so when filtering e.g. for B2 we get the two rows B2-4, B2-5

it looks similar to your case, right?

Thanks for the reply

But sorry my case is bit different

1st= Im not supposed to edit the original excel file

2nd = example when “D” is picked

it’s respected “Details” column & then the below “details” column value should be coming

I need a proper expression for it

as im using a type into activity to writer those 2 sperate values…in different places

Hopefully now you got my question

we do it temporary on datatable and do not change the excel

after filling up we can filter e.g. on A, B, C… and will get the corresponding rows only

we can use the filter result and process it

to stay on the sample data, after filling up and filtering on a particular value we get

However as there are also altrnate implementations possible, maybe you will prefer another approach as well

1 Like


May I know any alternative approaches please ??

Without using filter datatable

grouping data can help after filling up

as described here

or a dictionary approach like this

done with:

(From d In dtData.AsEnumerable
Group d By k=d(0).toString Into grp=Group
Let v=grp.Select(Function (x) x(1).toString).toArray
Select t=Tuple.Create(k,v)).ToDictionary(Function (t) t.Item1, Function (t) t.Item2)