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
364
Custom Formulas in WebGrid cells
posted

Hi,

I am trying to use the WebCalcManager to process a number of user-defined formulas that can be selected as fields in a query, which is displayed to a WebGrid.

The user can choose a list of companies, a list of fields (which can include these user-defined formulas) and a specific period.  For example, Company list contains {Company1, Company2}, Field list contains one field, with the formula "{Field1}/{Field2}*100", and the period is 2006.4.

During DataBinding, I replace {Field1} and {Field2} with their actual values for each company for the period of 2006.4.  This would result in the following:

Company     CalcField 

Company1     344085/541315*100

Company2     34408/58819*100

My problem is when I try to calculate the formula, by applying it to a Text Field placed on my form, then take the result from this Text Field and place it in my DataTable used as the DataSource for my WebGrid, the result the first time I run the query is blank for both formulas.  Run the query again results in both fields containing the result of the second formula (for Company2).  There is no Formula set for the Text Field by default, which is likely the reason it is blank after the first run of the query.

I'm lost as to how to do this, since the formulas won't necessarily have the component fields as part of the actual grid, which means I can't set the formula during InitializeLayout.  Is there a better way of doing this than with the Text Field on the form?  Does anyone have any examples of how to do what I need to do?

I have attached a zip file with a sample project which illustrates the issue I am having.  Please help!

Thanks, Mark

CalcManagerIssue.zip
Parents
  • 364
    Verified Answer
    posted

    Hi,

    Further to my issue, I did find a solution to this, without using a TextField as my formula staging area.

    All I needed to do was run the Calculate() method of the UltraWebCalcManager object on my form.  It now works perfectly, so this issue can be considered closed.

    Just one thing, thanks to these forums for being here.  They have helped me with a number of issues I have had and have really saved my sanity in the last few months.

    Thanks, Mark

Reply Children
No Data