AD
Administrator
Syncfusion Team
November 1, 2005 07:09 PM UTC
Where are you seeing these results? If I open \Essential Studio\3.3.0.0\Windows\Calculate.Windows\Samples\DataGridCalculator,and enter this formula into cell B4, it comes back with the value of 2.
=countif(a1:a3, ">1")
BT
Byron Tate
November 1, 2005 08:01 PM UTC
I confirm that the demos work correctly for countif. I apologize for not trying them first. The problem is more complicate because I''m using some unpublished public methods on the engine. I get and use the Parse method like this, as per instructions I got from one of my Direct-trac issues concerning performance for large grids:
System.Reflection.MethodInfo ParseFormulaInfo;
private string ParseFormula(string formula)
{
if(ParseFormulaInfo == null)
{
ParseFormulaInfo = typeof(GridFormulaEngine).GetMethod("Parse",
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.InvokeMethod |
System.Reflection.BindingFlags.Public
, null, new Type[1]{typeof(string)}, null);
}
object os = null;
if(ParseFormulaInfo != null)
{
os = ParseFormulaInfo.Invoke(m_Engine, new object[]{formula});
}
return os.ToString();
}
I call my function, ParseFormula with a string which is one of my named ranges preceeded by ''=''.
"count(J1:J2)" works OK as the value of the named range.
But in this case the value of the named range is:
"countif(J1:J2,\">1200\")"
the countif statement gives an ArgumentOutOfRangeException, which occured in mscorlib.dll, with added info "Length cannot be less than zero"
I understand that I have a non-standard use of the engine here, and it''s working great so far with all my issues that have been posted in direct-trac. I have not ever tried this particular function up till now, and I know I could write my own. So I don''t expect you to spend a lot of time debugging this since you don''t have my complete code setup.
AD
Administrator
Syncfusion Team
November 2, 2005 09:49 AM UTC
The problem is with using quoted strings inside namedranges. These are not being parsed properly(strings are cached before the namedranges are substituted-meaning that the strings inside namedranges are not properly cached). We will have to fix this in our source code. I do not know of a work around for this.