This is a migrated thread and some comments may be shown as answers.

Correctly return ArrayExpression (range of cells) from FunctionBase

1 Answer 31 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Igor asked on 01 Apr 2016, 09:37 AM

I created a some function inherited from the FunctionBase: 

public class MyFunc : FunctionBase

And i want to return result into two cells: 

return new ArrayExpression(new RadExpression[,] { { new StringExpression("123"), new StringExpression("321") } });

But when i use my function in spreadsheet, only one cell correctly filled. I expect that will be filled with a range of two cells "123" and "321".

How to correctly fill range of cells from MyFunc?


Thank you.


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 06 Apr 2016, 08:48 AM
Hello Igor,

Thank you for contacting us.

When using some function in a cell the result from this function is returned only to the owner cell. That said when you return ArrayExpression it is returned only in the cell that uses your function and not in the neighbouring cells. However, this result may be used by other functions that accept arguments of type array. 

Here are a few examples on using Array expressions. Let's take for instance this expression:
={1, 2, 3; 4, 5, 6}
 This is an array expression with two rows and three columns. On the first row the values are "1", "2" and "3", while on the second the values are "4", "5" and "6".

This expression may be used by different functions. Let's take for instance the INDEX function which returns elements from an array argument. The following function call for example returns the element from the second row and the first column of the array.
So the result of the above expression is "4".

The following function call returns the second column from the array argument as another ArrayExpression:

 If we need to use the result from this function to sum the elements from the second column we may write the following:
The result from the last expression will be 7 as it sums 2 and 5.

I hope this is helpful. If you have any other questions or concerns please do not hesitate to contact us again.

the Telerik team
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question