Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
680
Summaries on unbound columns that have formulas
posted

I have written an application that allows my users to apply an unbound column to the grid.   Then using formula builder dialogue apply a formula to perform thier own calculations in the grid on existing data.  When they try to add a summary it will only allow count, max and min.  I am assuming this is because when adding the unbound column for the formula I am letting the grid decide the data type to use (found this trick in another post that described a unhandled exception scenario in the calc engine).  If I assign the data type (System.Double) everything works fine.  Summaries work everything seems great until you try to apply a formula in that column that manipulates string data and returns a string.  There is an unhandled exception somewhere in the calc engine that kills the application as per the first article I found that told me about the trick how to not get the unhandled exception.  Typical setup of the code is as follows: 

calcMan.SuspendCalc();

CreateColumnReturn newColumn = CreateFormulaColumn();

 

if (newColumn.Created)

    {

     gridQueryData.CalcManager = calcMan;

     ShowFormulaBuilderDialog(newColumn.NewColumn);

     }

    calcMan.ResumeCalc();

}
unhandled exception occurs right when calcMan.ResumeCalc() is called.  I have to allow the user to summarize the column it only makes sense.  Should I submit a case or is this fixed in the most recent version?  I am on 2008 Volume2.   

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    Well... if you have a column in the grid whose DataType is double, you cannot have a formula in that column that returns a string - the value of the cell must be a double.

    It probably should not be crashing the application with an unhandled exception, but there's no way this can work the way you want it to.

    If the field is a double and you need to calculate a numeric summary, then why is the formula returning a string? Is this just an error on the part of the user?

Children