Hello,
Is it possible to disable calculation if the value from a field which is an input field for a formula is null. Example:
Say we have 3 fields on the form:
- Field a: XamNumericEditor (no formula)- Field b: XamNumericEditor (no formula)- Field c: XamNumbericEditor (formula: [//a] + [//b])
Now when the window is loaded the calculation engine is triggered and field c will contain 0,00 as a value even though field a and b are empty.
Is it possible to change this so that field c is only calculated when all fields are filled with values (value != null)
RegardsJohannes
Hello Johannes,
Thank you for your replies. I am very glad that you have managed to solve the issues that you were having. If you have any question please do not hesitate to ask.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Just one quick addition to the solution "" did not work for me. I used Null(). This seams to work fine.
Hi Sandip,
thanks for the reply. That helped indeed! And it even works in XamDataGrids. Many thanks
Hi Johannes,
Formulas are always evaluated - there is no way to conditionally prevent evaluation based on the source values. However you can use the IF and ISBLANK functions to get the desired result. If you use the following formula instead, it will evaluate to blank when one of the source values is also blank.
if( or(isblank([a]), isblank([b])), "", [a] + [b])
Hope this helps,
Sandip
Thank you for your post. I have been looking into your question and I can suggest is using the manual calculation mode of the XamCalculationManager. You can do that by setting the CalculationFrequancy property of the XamCalculationManager to Manual. By doing so, the XamCalculationManager will not perform any calculations until the PerformCalculations method is called (you can read more detailed information regarding the CalculationFrequancy here: http://help.infragistics.com/Help/NetAdvantage/WPF/2011.2/CLR4.0/html/InfragisticsWPF4.Calculations.XamCalculationManager.v11.2~Infragistics.Calculations.XamCalculationManager~CalculationFrequency.html). After setting that property you can use the ValueChanged event of the XamNumericEditor and call the PerformCalculations method only if the values of all editors are not null. I have created a sample application for you, that shows how you can implement this approach.
Please let me know if you need any further assistance on the matter.