Hello, I am setting my grid's datasource to a dataset object returned from a sql stored procedure.
In the grid's initialize layout I wire-up the calc manager:
this
.ugCommentary2.CalcManager = this.ultraCalcManager1;
I then wire-up a formula in one of the grid's columns:
e.Layout.Bands[0].Columns[
"MTD Gross Attribution"].Formula = string.Format("( ROUNDUP((([MTD % Contribution] * {0}) * 100),2) )",numGrossRetMTD.Text);
This works great, but only when you set the grid's datasource. "numGrossRetMTD" (above) is my UltraNumericEditior control. *My goal is to have all formula's in the grid re-fire every time a value is updated in the numeric editor control.
Just looking for the cleanest way to accomplish this. Many thanks in advance!
PS - I also tried adding the editor control to the calc settings in my form load event:
Infragistics.Win.UltraWinCalcManager.CalcSettings calcSettings = new Infragistics.Win.UltraWinCalcManager.CalcSettings();
calcSettings.PropertyName = "GrossRetMTD";
calcSettings.TreatAsType =
typeof(double);
.ultraCalcManager1.SetCalcSettings(this.numGrossRetMTD, calcSettings);
...but I have a feeling this was a pathetic attempt...
Hi,
The problem here is that you are hard-coding your formula with the current value (text) of the Numeric editor, rather than actually referring to the UltraNumericEditor in the formula itself.
The proper way to do this is like so:
.Formula ="( ROUNDUP((([MTD % Contribution] * [\\numGrossRetMTD]) * 100),2) )";
You probably also need to make sure that the NumericEditor is added to the CalcNetwork. The easiest way to do this is to go to the NumericEditor control at design-time and edit the CalcSettings.PropertyName and set it to Text.
But you seem to be doing all of this at run-time. So you could do it like this:
CalcSettings calcSettings = this.ultraCalcManager1.GetCalcSettings(this.ultraNumericEditor1); calcSettings.PropertyName = "Text"; calcSettings.TreatAsType = typeof(double);
Hey Mike, I've used so many of your posts that it is nice that you are the one responding to my first.
I had previously tried something like what you suggest (but did not want to write a novel in the initial post) where I created a method called from the form load event. The method contained these 4 lines"
Infragistics.Win.UltraWinCalcManager.CalcSettings calcSettings = new Infragistics.Win.UltraWinCalcManager.CalcSettings();calcSettings.PropertyName = "GrossRetMTD";calcSettings.TreatAsType = typeof(double);this.ultraCalcManager1.SetCalcSettings(this.numGrossRetMTD, calcSettings);
Seeing your post I immediately thought that the issue was with the formula because I had forward slashes in front of the control name, not backslashes in your emample above. [//numGrossRetMTD] vs. [\\numGrossRetMTD].
It does not work as I get #REF! in each cell with the formula. The interesting part is when I do have forward slashes before the control name [//numGrossRetMTD] I get a validation prompt (flashing red exclamation point) on the numGrossRetMTD control that states, "PropertyName not set or property not found on CalcSettings". This tells me that the forward slashes are correct, so I changed the four lines above to what you suggested:
CalcSettings calcSettings = this.ultraCalcManager1.GetCalcSettings(this.ultraNumericEditor1);calcSettings.PropertyName = "Text";calcSettings.TreatAsType = typeof(double);
This works on the intial load (yea!) but upon changing the value in ultraNumericEditor1, I now get an immediate validation prompt, "Input String was not in a correct format"...? I get no such prompt when I comment out the code to add the control to the CalcNetwork. What next? We're close!
Regards, Jaime