Why Datatable.Compute("MAX([Table]","") is not retrieving correct values with 3 digit numerics.
-
Hi, I am using
Datatable.Compute("MAX([Table]","")
to get the Minimum value in a column. It is getting correct values only if the column contains 2 didgit numbers. For example if amy column contains the values 100,180,85 like that,then it is not getting correct values.In this cas it getting 100 instead of 180.How to resolve this. Please show me the right way.. Thanks RPM. -
Hi, I am using
Datatable.Compute("MAX([Table]","")
to get the Minimum value in a column. It is getting correct values only if the column contains 2 didgit numbers. For example if amy column contains the values 100,180,85 like that,then it is not getting correct values.In this cas it getting 100 instead of 180.How to resolve this. Please show me the right way.. Thanks RPM.Rahul.P.Menon wrote:
I am using Datatable.Compute("MAX([Table]","") to get the Minimum value in a column.
I am quite sure that you don't. The syntax of the formula is not correct, and you can't use MAX to get a minimum... Show the code that you are actually using, instead. It's impossible to find the error you are looking for in code that doesn't even contain the error, but contain other errors instead. What is the data type of the field you are trying to get the minimum/maximum from? If you are comparing text, remember that "85" > "100".
--- Year happy = new Year(2007);
-
Rahul.P.Menon wrote:
I am using Datatable.Compute("MAX([Table]","") to get the Minimum value in a column.
I am quite sure that you don't. The syntax of the formula is not correct, and you can't use MAX to get a minimum... Show the code that you are actually using, instead. It's impossible to find the error you are looking for in code that doesn't even contain the error, but contain other errors instead. What is the data type of the field you are trying to get the minimum/maximum from? If you are comparing text, remember that "85" > "100".
--- Year happy = new Year(2007);
Hi Guffa, Thanks for thr reply..This is the code I have used to find min..
Dim expr As String = "MIN([" & dtn.Columns(1).ColumnName.ToString & "])" Dim min, max As Double min = CType(dtn.Compute(expr, ""), Double)
And that datattable column,I have tried is of System.string and system.double. But in both cases I am not getting the correct values if the column value contains more than 2 digits. Pls help me.. Thanks RPM. -
Rahul.P.Menon wrote:
I am using Datatable.Compute("MAX([Table]","") to get the Minimum value in a column.
I am quite sure that you don't. The syntax of the formula is not correct, and you can't use MAX to get a minimum... Show the code that you are actually using, instead. It's impossible to find the error you are looking for in code that doesn't even contain the error, but contain other errors instead. What is the data type of the field you are trying to get the minimum/maximum from? If you are comparing text, remember that "85" > "100".
--- Year happy = new Year(2007);
Guffa, You are right 100%..The mistake was with the code only.. As you said when I used the column type of system.Double instead of system.String it is giving correct values... Thanks very much for the great help and much appreciating. Thanks again, RPM.
SoftwareDeveloper(.NET)