I need to make a function that adds in the new column “calculate” the formula:
Col1*(1+Col3)*(1+Col2)
Thanks. But…
I wanted a function
var_DT.AsEnumerable().ToList().ForEach(Function (r)
r.SetField(“yourColumnName”, r.Field(“Col1”)(1+r.Field("Col3”))(1+r.Field(“Col2”))))
I tried this:
dt.AsEnumerable().ToList().ForEach(Function (r)r.SetField(“calculo”,r.Field(“col1”)(1+r.Field(“col3”))(1+r.Field(“col2”))))
don’t worked
Hi,
If you need function in the datatable, the following might help you.
dt.Columns("calculate").Expression = "col1*(1+col3)*(1+col2)"
If you need excel formula like =A1*(1+C1)*(1+B1)
, can you share address of the table in the worksheet.
Regards,
![Captura de tela 2022-09-22 090018|329x64](upload://o82:confused: TiKUCOJkU9GBBNW59glOrI.png)
can you share your flow?
Hi,
If your datacolumn is object type, the following might be better.
dt.Columns("calculate").Expression = "Convert(col1,'System.Double')*(1+Convert(col3,'System.Double'))*(1+Convert(col2,'System.Double'))"
Sample20220922-1.zip (2.8 KB)
Regards,
it worked!!
Thank you!!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.