Is it possible to get Calling cell information like Cell Object or Row Index and Column Index of Cuntom or User Defined function calling cell in Evaluate Method?
public class Function_Factorial : Infragistics.Silverlight.Excel.CalcEngine.ExcelCalcFunction { public override string Name { get { return "factorial"; } }
protected override ExcelCalcValue Evaluate(ExcelCalcNumberStack numberStack, int argumentCount) { // can we get cell row index and column index here?
return new ExcelCalcValue(this.CalculateFactorial(val)); }
private Int64 CalculateFactorial( Int64 value ) { if ( value == 0 ) return 1;
if ( value < 3 ) return value;
Int64 factorial = 2;
checked { for ( Int64 i = 3; i <= value; i++ ) { factorial *= i; } }
return factorial; } }
I also posted same question on following link in SilverLight Section:
http://forums.infragistics.com/forums/t/36403.aspx
Thanks
Out of curiosity... why would you need the cell or the row? What are yuo trying to do with it? Perhaps if I know more about what you want to do, I can suggest an alternative.
Hi Mike,
I have to perform some db fetching related task and from there custom function implementation, I am calling webservice asynchronously. now when it returns the results then i need to know exact cell to update the results.
If I can get a reference or cell and row index or any other related object then I can do identify the call from results
Imran Javed Zia
Hi,
Well, perhaps you can achieve what you want with more than one formula. For example, you could add an unbound column to the grid and use a formula to populate that unbound cells with a value based on the other data in the cell. And the perform a calculation on that column.
Another option would be to use the InitializeRow event and perform the calculations you need in code rather than using a formula.
I am using this in other environment than desktop application (SilverLight). Although these ways could be helpful but not suitable in my case.
Logged feature request FR12564. Duplicate post: http://community.infragistics.com/forums/p/36403/211513.aspx