Hi there,
Is there a simple way to convert a data table to an associative array? I'm trying to pass the associative array to an external API for analysis, and then getting the results back into JMP as a data table afterwards.
Thanks!
Howard
Check the scripting index (Help > Scripting Index). The AA will accept a matrix or a list as an input when you create it. So, the easiest way would be to get your Key column as a list, your value column as a list, and pass those to the AA command as the Keys and Values.
If you want to get multiple columns into your Value for a given Key you can do that too. There are some great examples in the scripting guide (Help > Books > JMP Scripting Guide). You can also look at the code I use here: Total Recall: A new strategy for Recall support in JMP applications for some examples on how I work with AA's.
M
Thanks, M. That was a good idea and I have implemented it.
I recently needed to convert datatable to associative array. Below is what I did
/********************************************** table to associative array ***************************************************/ dt = Current Data Table(); pe_steps = Associative Array(); ForEach( {i}, 1::ncols(dt), pe_steps[Column(dt,i) << get name] = Column(dt,i) << get values ); Show( pe_steps ); /********************************************** table to associative array ***************************************************/