Dear Team,
I have Values in excel like below
Values
60
18
30
15
40
55
19
I have to check below 20 values, add all those values in single varibale and print it.
For Ex. 18,15,19
Please let me know how to do this.
Thanks,
Amol
Dear Team,
I have Values in excel like below
Values
60
18
30
15
40
55
19
I have to check below 20 values, add all those values in single varibale and print it.
For Ex. 18,15,19
Please let me know how to do this.
Thanks,
Amol
@Amol_Golhar
Assign activity:
totalSum = 0
Read Range activity:
DataTable = Excel Application Scope → Read Range
For Each Row activity (DataTable):
If activity:
Condition: Convert.ToInt32(row(“Values”)) < 20
Then:
Assign activity:
totalSum = totalSum + Convert.ToInt32(row(“Values”))
Write Line activity:
"Sum of values below 20: " + totalSum
Hi @Amol_Golhar
Try this:
(From d In DT.AsEnumerable
Where Not (isNothing(d("Values")) OrElse String.IsNullOrEmpty(d("Values").ToString.Trim))
Select v = CDbl(d("Values").ToString.Trim)
).Take(20).Sum(Function(x) Convert.ToDouble(x))
Hope it will helps you
Cheers!!
Read The Excel Sheet
For Each Row Dt
if RowValue < 20
Assign OuputValue= OutputValue+RowValue
Write Line OutputValue
Hi @Amol_Golhar
Try this
DT.AsEnumerable().Where(Function(row) CInt(row("Values")) < 20).Sum(Function(row) CInt(row("Values")))
Input:
Output:
Cheers!!
Assign activity:
total = dtValues.AsEnumerable().Where(Function(row) Convert.ToInt32(row("Values")) < 20).Sum(Function(row) Convert.ToInt32(row("Values")))
If you want
Try this
String.Join(",", DT.AsEnumerable().Where(Function(row) CInt(row("Values")) < 20).Select(Function(row) row("Values").ToString()))
Cheers!!
Try this:-
string valuesBelow20 = string.Join(“,”, dt.AsEnumerable()
.Where(row => row.Field(“Values”) < 20)
.Select(row => row.Field(“Values”)));
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.