I’m trying to sum multiple column for each row (somme1 and somme 2)
Somme1= sum of (col1, col2,col3)
Somme2= sum of(col4, col5)
Data type of Columns i want to sum is string
even I used a sum formula already converted to double in Assign bloc, where I assigned the formula to “Somme” that I already change its type from string to double ant it return an error “Assign: Conversion from string “” to type ‘Double’ is not valid.”
Hi @BlueBird1
If you just want to sum two columns u can use this expression
Instead of using Foreachrow in activity
Step:1 drag Assign Activity
Left Side:
Your_Datatable.Columns(“Somme1”).Expression
Value side
“[Col1]+[Col2]+[Col3]”
Thanks
VP
Hi @BlueBird1
Inside for each row
Semme1 = Cdbl(CurrentRow(Col1).ToString)+Cdbl(CurrentRow(Col2).ToString)+Cdbl(CurrentRow(Col3).ToString)
Semme1 date type should be double
Thanks!
Hi
If you are using For each row datatable activity
use this Expression
Left Side
CurrentRow(“Semme1”)
Value side
(CDbl(“Col1”)+CDbl(“Col3”)+CDbl(“Col3”))
Thanks
VP
@Umadevi_Sanjeevi could you please check the workflow on the zip file I posted, and u can verify that I already respected what u said
Hi @BlueBird1 ,
Your value should be
If(String.IsNullOrEmpty(CurrentRow(“Col5”).ToString),0,CDBL(CurrentRow(“Col4”).ToString))+If(String.IsNullOrEmpty(CurrentRow(“Col5”).ToString),0,CDBL(CurrentRow(“Col5”).ToString))
Thanks!
where should i put the condition in my workflow exactly please
@Umadevi_Sanjeevi Please what expression should I put also in SommeNbre since the third row of col1, col2, col3 is also empty
Hi @BlueBird1
Find the expression for SommeNB
If(String.IsNullOrEmpty(CurrentRow(“Col1”).ToString),0,CDBL(CurrentRow(“Col1”).ToString))+If(String.IsNullOrEmpty(CurrentRow(“Col2”).ToString),0,CDBL(CurrentRow(“Col2”).ToString))+If(String.IsNullOrEmpty(CurrentRow(“Col3”).ToString),0,CDBL(CurrentRow(“Col3”).ToString))
Thanks!
i get this error : Cannot assign from Type “System.Double” to type “UiPath.Excel.ExcelValue” in assign activity
Hi @BlueBird1
Can you check below workflow. did not get any error from my side.
Hopefully this workflow will help you
Processusvierge7.zip (8.9 KB)
Thanks!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.