cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

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

Create Associative Array from Column Values

I would like to create an associative array from column values.  I am curious if anyone in the JMP community has a clever solution.  I am using JMP10.  An example is below.

// For the following data table:

example = New Table( "Example Data", Add Rows( 27 ),  New Column( "Lot", Character, Nominal, Set Values(

{"A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C", "C", "C", "C"}

) ),  New Column( "Test", Character, Nominal, Set Values(

{"Test1", "Test1", "Test1", "Test2", "Test2", "Test2", "Test3", "Test3", "Test3", "Test1", "Test1", "Test1", "Test2", "Test2", "Test2",

"Test3", "Test3", "Test3", "Test1", "Test1", "Test1", "Test2", "Test2", "Test2", "Test3", "Test3", "Test3"}

) ),  New Column( "Parameter", Character, Nominal, Set Values(

{"Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1",

"Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2",

"Param3"} ) ),  New Column( "Yield", Numeric, Continuous, Format( "", 16 ),

Set Values( [1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0] )

),  New Column( "Defect Code", Character, Nominal, Formula( If( :Yield == 0, :Test || "_" || :Parameter ) ) ) );

// I would like to create an associative array with key = Lot, and values = Defect Codes.  Please see example below.

// What is the best way to script this?

// As a bonus, is it possible to create an associative array with multiple levels (IE: Lot => Test => Parameter => Defect Code)?

Defects = Associative Array( example:Lot );

Defects["A"] = {"Test1_Param3", "Test2_Param2", "Test2_Param3", "Test3_Param2"};

Defects["B"] = {"Test1_Param1", "Test1_Param2", "Test1_Param3", "Test2_Param2", "Test3_Param2", "Test3_Param3"};

Defects["C"] = {"Test1_Param2", "Test1_Param3", "Test2_Param3", "Test3_Param3"};

// Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
robot
Level VI

Re: Create Associative Array from Column Values

If anyone is curious:

Defects = Associative Array( :Lot );

currentkey1 = Defects << First;

For( i = 1, i <= N Items( Defects ), i++,

  values1 = Associative Array( :Test[example << Get Rows Where( :Lot == currentkey1 )] );

  Defects[currentkey1] = values1;

  currentkey2 = Defects[currentkey1] << First;

  For( j = 1, j <= N Items( Defects[currentkey1] ), j++,

  values2 = :Defect Code[example << Get Rows Where( :Lot == currentkey1 & :Test == currentkey2 & :Yield == 0 )];

  Defects[currentkey1][currentkey2] = values2;

  nextkey2 = Defects[currentkey1] << Next( currentkey2 );

  currentkey2 = nextkey2;

  );

  nextkey1 = Defects << Next( currentkey1 );

  currentkey1 = nextkey1;

);

Show( Defects );

View solution in original post

2 REPLIES 2
robot
Level VI

Re: Create Associative Array from Column Values

I figured out how to create an associative array with key = Lot, and values = Defect Codes.

I am curious if there is any advice about associative arrays with multiple levels.  Thanks!

Defects = Associative Array( example:Lot );

currentkey = Defects << First;

For( i = 1, i <= N Items( Defects ), i++,

  values = :Defect Code[example << Get Rows Where( :Lot == currentkey & :Yield == 0 )];

  Defects[currentkey] = values;

  nextkey = Defects << Next( currentkey );

  currentkey = nextkey;

);

Show( Defects );

robot
Level VI

Re: Create Associative Array from Column Values

If anyone is curious:

Defects = Associative Array( :Lot );

currentkey1 = Defects << First;

For( i = 1, i <= N Items( Defects ), i++,

  values1 = Associative Array( :Test[example << Get Rows Where( :Lot == currentkey1 )] );

  Defects[currentkey1] = values1;

  currentkey2 = Defects[currentkey1] << First;

  For( j = 1, j <= N Items( Defects[currentkey1] ), j++,

  values2 = :Defect Code[example << Get Rows Where( :Lot == currentkey1 & :Test == currentkey2 & :Yield == 0 )];

  Defects[currentkey1][currentkey2] = values2;

  nextkey2 = Defects[currentkey1] << Next( currentkey2 );

  currentkey2 = nextkey2;

  );

  nextkey1 = Defects << Next( currentkey1 );

  currentkey1 = nextkey1;

);

Show( Defects );

Recommended Articles