cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Function Not being Recognized in Xcelsius

Former Member
0 Kudos

Background:

Xcelsius Version: 5.4.0.0 (Build Number 12,4,0,116)

Add-On Packager Versions: 2.1

Command Line Verison of Flex SDK: 2.01 hotfix 3 (Build 180927)

-


What Ive Tried:

Ive written a custom function (.mxml code is listed at the bottom of this post) called arrayIndex that splits a String about a passed in delimiter, and returns a passed in index value of the newly formed array.

I have compiled the script successfully (or so I believe) with the command line mxmlc tool provided with the flex sdk. I have added the file xcelsiusframework.swc to the lib directory of the Flex installation. In addition, my flex-config.xml contains the following entry:


<library-path>
      <path-element>libs</path-element>
      <path-element>locale/{locale}</path-element>
</library-path>

I can then take the outputted swf file from the mxmlc, and run it through the Add-On packager with no complications. Building an xlx file as intended.

I am then able to add in the resulting xlx file to Xcelsius. Upon a save and exit I am able to see that the addon is registered.

-


What is Wrong?:

I am referencing the array with the following:


=arrayIndex(E1,2,"^")

Where E1 contains:

ThisIsSomeSeparatedText

However when I try to reference the custom function, I get an error on preview, stating:

UnSupported Excel Function: arrayIndex

I am able to make a trivial Hello World function work using the stated procedure above. That trivial function contains no xcelsius module import statements, which leads me to believe the issue may be in how the function is constructed in the script or in how I am compiling it (maybe missing some explicit reference to the xcelsiusframework.swc ).

Can Anyone Identify What the Issue is?

-


My Script:

These are my import statements:


	import xcelsius.spreadsheet.ICellSDK;
	import xcelsius.collections.ITableSDK;
	import xcelsius.spreadsheet.FunctionError;

Ive also included the getStringUtil and getNumberUtil functions from the ~\Xcelsius\SDK\samples directory, However I am having trouble getting it all to display properly in the post, so Ive left them out. I can post them in a reply if needed.

Below is the arrayIndex functionI wrote:


public function arrayIndex(arg:*, NDX:*, delimiter:*):*
{
	var s:*; // 'arg', converted to String
	var d:*; // 'delimiter' converted to String
	var i:*; // 'NDX' converted to a numerical value
	var a:*; // array to query
	
	// None of the arguments should refer to range of values (single cells are OK)
	if ((arg is ITableSDK) || (NDX is ITableSDK) || (delimiter is ITableSDK)) {
		return new xcelsius.spreadsheet.FunctionError(xcelsius.spreadsheet.FunctionError.VALUE);
	}
	
	// both 'arg' and 'delimiter' should be strings
	s = getStringUtil(arg);
	d = getStringUtil(delimiter);
	
	// NDX should be a number
	i = getNumberUtil(NDX);
	
	// if after the conversions, if 'i', 's' or 'd'  
	// is an Excel error,  return that error
	if (s is xcelsius.spreadsheet.FunctionError) { 
		return s;
	} else if (d is xcelsius.spreadsheet.FunctionError) { 
		return d;
	} else if (i is xcelsius.spreadsheet.FunctionError) {
		return i;
	}
	
	// cannot perform the operation on an empty String or with an index < 0
	if ((s == "") || (i < 0)) {
		return new xcelsius.spreadsheet.FunctionError(xcelsius.spreadsheet.FunctionError.VALUE);
	}
	
	// Split the string 'arg', delimited by 'delimiter' 
	a = s.split(d);
	
	// if 'NDX' > the highest index in a, then return an error
	if (i > (a.length - 1)) {
		return new xcelsius.spreadsheet.FunctionError(xcelsius.spreadsheet.FunctionError.VALUE);
	}
	
	// return the value
	return a<i>;
} 

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I wanted to post some clarification of the issue I am experiencing. Using the example in the blog post found [here|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/26578] [original link is broken] [original link is broken];, I copied the code verbatim, and compiled it using the Flex 2.01 Hotfix 3 compiler using the following command:


mxmlc C:
everse.mxml

The same issue happens where when I use the function in Xcelsius, it is not recognized. This is telling me that with an example that has been tried, and is supposed to work, something in my process is broken/not working as expected.

Can anyone clarify if there are some additional command line options I need to set when compiling a Custom Function swf for Xcelsius?

I have tried the following in various combinations.:


-compiler.include-libraries="PATHTOXCELSIUSSWCFILE.swc"
-compiler.strict