cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to use JMP Pro to analyze and predict using entire data set rather than selected points in a curve. Register for Nov. 6 Mastering JMP.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
ALopez
Level III

How to create an array from Column Names and values.

I have a table that has 3 columns and a single row of values and I am trying to create an Associative array from it,

ALopez_0-1611777859364.pngALopez_0-1611777859364.png

I have tried this:

Names Default To Here( 1 );
dt = Current Data Table();
keysList =  dt << Get Column Names(string);
tablData = Associative Array();
For(i=1, i <= N Items(KeysList), i++,
tablData<< Insert(KeysList[i])
); //end of For
tablData << Get Values;

The array is created but all the values are => 1.

I was expecting : tablData = ["deep" => 40, "length" => 20, "width" => 10];

I will appreciate your help fixing my code. 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to create an array from Column Names and values.

You could do something like this...

Names Default To Here( 1 );
dt = Current Data Table();
keysList = dt << Get Column Names( string );
tablData = {};
For( i = 1, i <= N Items( KeysList ), i++,
	Insert Into( tablData, Column( KeysList[i] )[1] )
); //end of For
aa = Eval List( Associative Array( keysList, tablData ) );

 

Wendy

View solution in original post

2 REPLIES 2

Re: How to create an array from Column Names and values.

You could do something like this...

Names Default To Here( 1 );
dt = Current Data Table();
keysList = dt << Get Column Names( string );
tablData = {};
For( i = 1, i <= N Items( KeysList ), i++,
	Insert Into( tablData, Column( KeysList[i] )[1] )
); //end of For
aa = Eval List( Associative Array( keysList, tablData ) );

 

Wendy
ALopez
Level III

Re: How to create an array from Column Names and values.

Hi @Wendy_Murphrey. I had a tried something similar but I always forget the "Eval List".  Thank you very much for your help and the lesson.

Recommended Articles