I have 4 types of vaccines on excel, I have the price of each vaccine.
I would need to use UiPath to sum up the total number of vaccines for each category and the total price.
How do I do that?
What are the variables and which activity do I use etc?
// Assuming the category column is named “Category” and the price column is named “Price” in the DataTable
// Make sure to replace “vaccineData” with the actual name of your DataTable variable
// Calculate the total number of vaccines for each category
Dim totalVaccinesByCategory = From row In vaccineData.AsEnumerable()
Group row By category = row.Field(Of Integer)(“Category”) Into Group
Select New With {
.Category = category,
.TotalVaccines = Group.Sum(Function(row) row.Field(Of Integer)(“Quantity”))
}
// Calculate the total price for each category
Dim totalPriceByCategory = From row In vaccineData.AsEnumerable()
Group row By category = row.Field(Of Integer)(“Category”) Into Group
Select New With {
.Category = category,
.TotalPrice = Group.Sum(Function(row) row.Field(Of Decimal)(“Price”))
}