Hi Team,
I have problem , if Id is matching then I have to sum the unit amount of the same id and paste the result in the 1st index of the matched Id under Amount column as below. how to achieve this using LINQ?
Probelm
Solution
Hi Team,
I have problem , if Id is matching then I have to sum the unit amount of the same id and paste the result in the 1st index of the matched Id under Amount column as below. how to achieve this using LINQ?
Probelm
Solution
have a look here, as the case can be solved by grouping the data and processing the group members
If your data is in Excel, and you want to manipulate it in Excel, just use UiPath to automate writing the SUMIF function in Excel. Then read the result from Excel.
Makes more sense that trying to recreate a simple Excel function using LINQ.
Useful to remember that UiPath is for automation, not general purpose coding, so use it to automate.
Hi @ppr , thanks. but this is not giving me expected result for Amount column rather its removing the duplicates in ID column after running grp by. Could you please help me on this to achieve exactly same as above using LINQ?
we dont know what you had implemented.
However, when we apply it on our end, we can do:
input:
output:
which is similar to your above-given samples. It was done within a hybrid approach but using Grouping the data with a group by as mentioned above with the given link
For each Loop:
dtData.AsEnumerable.GroupBy(Function (x) x("ID").toString.Trim).Select(Function (g) g.ToList())
grp.First()("Amount") =
grp.Sum(Function (g) CInt(g("Unit Amount").ToString.Trim))
For further learning also have a look here:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum
How to Update Data Column Values of a Data Table | Community Blog
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.