Hii Guys!!
I have a column with Numeric values. I have to add all the values in the column with each other. But the no of line items in the column is not fixed. It may have more no of line items sometimes. How can I add all the Values? Help me to Solve in this.
Thanks in Advance
1 Like
Blesslin
(Blesslin Jeba Shiny A)
March 11, 2022, 3:30am
2
Hi @mohamedalthaf
You can use linq to get the sum.
1 Like
Hi @mohamedalthaf
Please have a look.
Hope this helps to solve.
Thanks.
1 Like
Hi
Hope the below expression would help you resolve this
It doesn’t rely on number of line items
And can handle any number of rows
Use read range activity and get the datatable dt as output
Then use a assign activity like this
dou_sumvalue = dt.AsEnumerable.Sum(Function(x) If(IsNumeric(x(“Amount”).ToString.Trim),CDbl(x(“Amount”).ToString.Trim),0))
Where dou_sumvalue is a variable of type system.double
For more details on data le functions
Hi All,
Datatable - variable type is the most commonly used variable type by all UiPath users
And it’s been the most often asked queries in forum especially on its manipulation
So I would like to have this post as a repository for those who are looking for expressions related to Datatable
Let’s go one by one keeping dt as name of datatable variable
1. Get number of rows in a datatable dt
dt.Rows.Count (output - int32 type)
2. Get number of columns in a datatable dt
dt.Columns.Count (output…
Cheers @mohamedalthaf
1 Like
Gokul001
(Gokul Balaji)
March 11, 2022, 4:27am
6
Hi @mohamedalthaf
Try this below expression
(From d in dtData.AsEnumerable Where Not (isNothing(d(Amount)) OrElse String.IsNullorEmpty(d(Amount).toString.Trim)) Select v = CDbl(d(Amount).toString.Trim)).Sum(Function (x) x)
Regards
Gokul
1 Like
system
(system)
Closed
March 14, 2022, 4:55am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.