Hi,
i have got an wingrid in which i need to show the summary of all the rows, but one of the columns is a calculated column in which even the summary needs to be calculated ..
i would like to check for the divide by zero exception ..
is there anyway by which i can check before i assign the formula
summaryPercentageAppliedForReceived.Formula = "Sum([" + _applliedForAmountLabel + "]) / " + "Sum([" + _ReceivedAmountLabel + "])" ;
but this will work as long as the "Sum([" + _ReceivedAmountLabel + "])" is greater than zero . else it will disaply something Like NaN
so what i am looking for is something like
if ( "Sum([" + _ReceivedAmountLabel + "])" > 0)
{
"Sum([" + _applliedForAmountLabel + "]) / " + "Sum([" + _ReceivedAmountLabel + "])" ;
}
else
" 0 ";
can you please let me know if there is any other way i can do this.
thank you for your help in advance,
The "if()" formula already provides an if/else construct:
if(<condition>,<result if true>, <result if false>)
Hi Mike,
Can you use If .... else for the formula
Thanks,
That should work, also. :)
Thank you for your help,
actually i found a work around for this at the moment i am setting any data type, but i will try with that as well.
what i am acutally doing at the moment is
_uiTargetsDataGrid.DisplayLayout.Bands[ 0 ].Columns[ _percentageReceivedLabel ].MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;
_uiTargetsDataGrid.DisplayLayout.Bands[ 0 ].Columns[ _percentageReceivedLabel ].MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;
i dont know whether this is the correct way to do it. but at the moment it seems to be working for me. but i will try to set the data type and set the format property.
Thank you.
Use the Format property of the column. What format you use depends on the data type of the column, but you can probably use a format like "p" for percent.