Hi all,
I need to calculate sum,maximum and minimum for all the columns in the attached excel sheet. Can you please help me out with this ASAP.
Hi
To get the sum
dt.AsEnumerable().Sum(Function(x) If(IsNumeric(x(“Column2”).ToString.Trim),CDbl(x(“Column2”).ToString.Trim),0))
To get the Max
dt.AsEnumerable().Max(Function(x) If(IsNumeric(x(“Column2”).ToString.Trim),CDbl(x(“Column2”).ToString.Trim),0))
To get the Min
dt.AsEnumerable().Min(Function(x) If(IsNumeric(x(“Column2”).ToString.Trim),CDbl(x(“Column2”).ToString.Trim),0))
Cheers @Manideep2701
hey @Palaniyappan
I have tried using assign activty (sum= dt.AsEnumerable.Sum(Function(x) If(IsNumeric(x(“Column2”).ToString.Trim),CDbl(x(“Column2”).ToString.Trim),0)))
Variable type of sum is Decimal.
still it is not working.
I have attached the error below
can you please suggest me on this ASAP.
thank you.
Hey
Sorry for the delayed response buddy
Fine
Is AsEnumerable() coming once after typing dt.
If that method is not coming then we need to check once the assembly reference and add if it’s not there
Open your main.xaml with notepad or any editor and add the assembly reference as mentioned here
Cheers @Manideep2701
Try out this method in Assign,
DataType as Double
dt.AsEnumerable().Sum(Function(x As DataRow) CDbl(x(“Open”).ToString.Trim))
“Open” is column Name
@cheers
@Shiva_Raj @Palaniyappan
The Scenario here is when i’m trying to put the code in the field the function ".sum(Func… " is not reflecting after the expression ‘dt.AsEnumerable()’. This is happening only in my desktop and its working completly fine in my colleagues desktop and also in one of the forum member’s desktop. I have uninstalled the studio and re-installed too.
When your system looks good try the attached. ExcelSeq.xaml (14.1 KB)
Its based on the same logic that is given in the above comments however additional logic to get the required results
just pay attention to your quotes… delete them and type it again, dont copy paste…
Thank you all @Palaniyappan @nadim.warsi @Shiva_Raj for your time.
I have rebuilt the sequence and found its working. Now i can access the '.Sum(func… '.
yes @bcorrea I have been careful about that. Thank you
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.