Hi Everyone,
I want to multiply two columns in datatable using linq query (both columns are of type Double)
Hi Everyone,
I want to multiply two columns in datatable using linq query (both columns are of type Double)
Hi @amalmarella
You can invoke a code like this
var_DT.AsEnumerable().ToList().ForEach(r=> r.SetField("yourColumnName",r.Field<Double>("FirstColumn")*r.Field<Double>("SecondColumn")));
Thanks,
Prankur
If your xaml is in C# then only use the above code.
var_DT.AsEnumerable().ToList().ForEach(Function (r)
r.SetField(“yourColumnName”,r.Field(“FirstColumn”)*r.Field(“SecondColumn”)))
Use this one
@amalmarella he is correct its a C# code. Thanks @Divyanshu_Divyanshu
Hi @amalmarella
You can try this way and get the product of the 2 columns in a array too
data_arr= dt1.Select(Function(row) (CDbl(row(column1))*CDbl(row(column2))).ToString).ToArray()
Try this way too
Regards
Nived N
Happy Automation
Thanks Ankur & divaynshu it is working , Thanks nived for your response
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.