cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
FN
FN
Level VI

Error using associative array (dictionary) // subscripted key not in map in access or evaluation

For some reason, a script that was working stopped (both in JMP 16 and 17) and now I am getting the following error

 

subscripted key not in map in access or evaluation of 'aaa (bbb) [ccc]' , "aaa (bbb) [ccc]"

I have a small script that renames the columns of a secondary table to a primary table. First, an associative array is created (not shown).

 

Then I iterate through the columns.

 

new_colNames = dt_secondary << Get Column Names( "String" );
Print( "Iterating through new column names" );
For( i = 1, i <= N Items( new_colNames ), i++,
	new_colName = new_colNames[i];
	Print( "Changing name for column:", new_colName );
	user_colname = dict_colNames << Get Value( new_colName );
	Print( "To user column name:", user_colname );
	Column( dt_transposed, new_colName ) << Set Name( user_colname );
);

Not sure what can be the reason. When using the debugger, I can see that key exists in the dictionary.

 

This error occurs with multiple columns that, to me, look like identical strings.

1 REPLY 1
Craige_Hales
Super User

Re: Error using associative array (dictionary) // subscripted key not in map in access or evaluation

Keys must be exact, including white space. The hex() function might be useful for examining the keys. Something like this

try( ... use the aa with key ...
, // catch errors, show the keys
show(exception_msg, hex(key), char(aa));
)

I sometime leave the try(...) in my JSL so when an unexpected error happens there will be better info in the log. That's especially useful when the key or aa might be a local variable in a function or enhanced for loop and be gone after the error message.

Craige