how to get second column value based on first column value
Hi @Yogita_Gaikwad,
for you current problem you can use lookup table activity and pass one column name as lookup column and provide the target column name whose value you want to get in properties section of the activity.
In my workflow I am getting the name of a person from the ID value I am passing.
Please go through my workflow to get your solution, I have also attached the sample excel file for your reference.
Forum.zip (7.7 KB)
Thanks & Regards,
Shubham Dutta
consider their are two same id 102,102 then how i get that values in second column
ex.
Id name
102 yogita
102 Akshay
103 neha
104 kapil
Output***
want output for 102
yogita
Akshay
How about this expression?
(From d In BuildDT.AsEnumerable
Group d By k=d("Id").toString.Trim Into grp = Group
Let nj = String.Join(" ",grp.Select(Function (n) n("name").toString.Trim))
Let ra = New Object(){k,nj}
Select r = DtOutput.Rows.Add(ra)).CopyToDataTable
DtOutput → BuildDT.Clone
Regards
Gokul
consider if their are two same id ex 104 but name diffrent then
ex
id name
101 yogita
102 kamlesh
104 akshay
104 arvind
105 nikhil
output for 104
akshay
arvind
Have you test the XAML file. It will gives you the output @Yogita_Gaikwad
if i have excel file then how do it without build data table
Instead of Build Data Table use Read Range activity and pass the → Store it in BuildDt
Regards
Gokul
if i want to get only 104 second column record then
How about this expression?
(From p in BuildDt.Select() where( From q in BuildDt.Select() where q("Id").Equals(p("Id")) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()
You can try to get the Duplicate Record from ID column
Check out the XAML file
LinqGetData.xaml (10.5 KB)
Output
Regards
Gokul
Hi @Yogita_Gaikwad ,
I understood your actual requirement now.
I am attaching the zip file which consists xaml file and sample excel file. Use it for your reference and I hope you will get your desired output.
Forum.zip (8.5 KB)
Have a good day!
Thanks & Regards,
Shubham Dutta
output of this for 102 is suraj and sam is right and can u tell me if i want to remove row suraj and sam from second excel where they are present
Hi @Yogita_Gaikwad ,
I did not understand your question, did you mean you want to delete the records from excel if they have same ID?
this is first excel
|Name | ID |
|Raman| 101|
|Suraj |102|
|Vikram|103|
|Sam |102|
this is second excel
|Name | Adress | info |
|Raman| ssd nagar |qweeff
|Suraj | viman nagar |wedr4r
|Vikram| ganesh nagar |12e3r4
|Sam | Peth |sdhwiudue
i want suppose 102 has two names suraj and sam then remove suraj and sam record row from second excel
--------------output-------------
|Name | Adress | info |
|Raman| ssd nagar |qweeff
|Vikram| ganesh nagar |12e3r4
Hi @Yogita_Gaikwad ,
for your this use case I am attaching a workflow for your response.
I think this will help you to get your solution.
Forum.zip (14.9 KB)
Thank & Regards,
Shubham Dutta
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.