<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Stacking in JSL indexed columns by group (sensor data and assets) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612324#M81245</link>
    <description>&lt;P&gt;In manufacturing, is common to extract sensor data in the following form, where&amp;nbsp;&lt;SPAN&gt;A and B correspond to similar devices (known as &lt;A href="https://www.youtube.com/watch?v=VWrxS48PpjY" target="_self"&gt;assets&lt;/A&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this format, the user needs to create a combined formula for each parent group. For example:&lt;/P&gt;&lt;P&gt;(Input: Sensor data table needs specific columns per parent group)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FN_0-1680074640769.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51564iC0790E2123695CE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FN_0-1680074640769.png" alt="FN_0-1680074640769.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When handling several assets, this becomes cumbersome, so a better way is to stack the data per group asset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do this programmatically, we need contextual data containing the hierarchy. For example:&lt;/P&gt;&lt;P&gt;(Input: asset hierarchy)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FN_1-1680074739752.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51565i2A443326A567ACD1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FN_1-1680074739752.png" alt="FN_1-1680074739752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In JSL, how can you move from the sensor data and hierarchy (inputs) to the asset table (desired output)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(output: asset data table)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FN_2-1680074878597.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51566i218DCD57D011540F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FN_2-1680074878597.png" alt="FN_2-1680074878597.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All tables and scripts are attached. Here is the input table script (metadata containing parent-child is added as column properties).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// New data table
dt = New Table( "sensor table" );

n_rows = 10;

n_additional_rows = 0;

// New column: Index
dt &amp;lt;&amp;lt; New Column( "Index", Numeric, "Continuous", Format( "Best", 12 ) ) &amp;lt;&amp;lt;
	Begin Data Update &amp;lt;&amp;lt; Add Rows( n_rows );

dt:Index &amp;lt;&amp;lt; Set Formula( Row() );

dt &amp;lt;&amp;lt; End Data Update;


// A sensor

dt &amp;lt;&amp;lt; New Column( "A sensor 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "A sensor 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "A sensor 3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; Group Columns( "A sensors", {:A sensor 1, :A sensor 2, :A sensor 3} )
	 &amp;lt;&amp;lt; Begin Data Update;

For Each Row(
		dt,
		:A sensor 1 = Random Normal( 0, 1 );
		:A sensor 2 = Random Normal( 0, 1 );
		:A sensor 3 = Random Normal( 0, 1 );
	);
	
dt &amp;lt;&amp;lt; End Data Update;

// B sensors

dt &amp;lt;&amp;lt; Add Rows( n_additional_rows );


dt &amp;lt;&amp;lt; New Column( "B sensor 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "B sensor 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	/*) &amp;lt;&amp;lt; New Column( "B sensor 3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected*/
	) &amp;lt;&amp;lt; Group Columns( "B sensors", {:B sensor 1, :B sensor 2}) //, :B sensor 3} )
	 &amp;lt;&amp;lt; Begin Data Update;

For Each Row(
		dt,
		:B sensor 1 = Random Normal( 0, 3 );
		:B sensor 2 = Random Normal( 0, 2 );
		//:B sensor 3 = Random Normal( 0, 3.5 );
	);
	
dt &amp;lt;&amp;lt; End Data Update;

colnames = dt &amp;lt;&amp;lt; Get Column Names( String );

for each({col, index}, colnames,
		column(dt, col) &amp;lt;&amp;lt; Set Property( "child", col ) );

// Calculations.

// New formula column: Stdev[A sensor ...r 2,A sensor 3]
dt &amp;lt;&amp;lt; New Column( "Stdev[A sensors]",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( Std Dev( :A sensor 1, :A sensor 2, :A sensor 3 ) ));
	
// Move selected column: Stdev[A sensors]
dt &amp;lt;&amp;lt;Move Selected Columns( {:"Stdev[A sensors]"n}, after( :A sensor 3 ) );
	
// New formula column: Stdev[A sensor ...r 2,A sensor 3]
dt &amp;lt;&amp;lt; New Column( "Stdev[B sensors]",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( Std Dev( :B sensor 1, :B sensor 2) ));//, :B sensor 3 ) ));
	
// Move selected column: Stdev[A sensors]
dt &amp;lt;&amp;lt;Move Selected Columns( {:"Stdev[B sensors]"n}, after( :B sensor 2 ) );

// Create metadata

For Each( {col, index}, {:A sensor 1, :A sensor 2, :A sensor 3},
		col &amp;lt;&amp;lt; Set Property( "parent", "A" ) &amp;lt;&amp;lt; Set Property( "parent_alias", "asset" )
	);


For Each( {col, index}, {:B sensor 1, :B sensor 2}, //, :B sensor 3},
		col &amp;lt;&amp;lt; Set Property( "parent", "B" ) &amp;lt;&amp;lt; Set Property( "parent_alias", "asset" )
	);

For Each( {col, index}, {:A sensor 1, :B sensor 1},
		col &amp;lt;&amp;lt; Set Property( "child_alias", "sensor 1" ) 
	);

For Each( {col, index}, {:A sensor 2, :B sensor 2},
		col &amp;lt;&amp;lt; Set Property( "child_alias", "sensor 2" ) 
	);


For Each( {col, index}, {:A sensor 3},//, :B sensor 3},
		col &amp;lt;&amp;lt; Set Property( "child_alias", "sensor 3" ) 
	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2023 16:28:35 GMT</pubDate>
    <dc:creator>FN</dc:creator>
    <dc:date>2023-06-08T16:28:35Z</dc:date>
    <item>
      <title>Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612324#M81245</link>
      <description>&lt;P&gt;In manufacturing, is common to extract sensor data in the following form, where&amp;nbsp;&lt;SPAN&gt;A and B correspond to similar devices (known as &lt;A href="https://www.youtube.com/watch?v=VWrxS48PpjY" target="_self"&gt;assets&lt;/A&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this format, the user needs to create a combined formula for each parent group. For example:&lt;/P&gt;&lt;P&gt;(Input: Sensor data table needs specific columns per parent group)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FN_0-1680074640769.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51564iC0790E2123695CE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FN_0-1680074640769.png" alt="FN_0-1680074640769.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When handling several assets, this becomes cumbersome, so a better way is to stack the data per group asset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do this programmatically, we need contextual data containing the hierarchy. For example:&lt;/P&gt;&lt;P&gt;(Input: asset hierarchy)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FN_1-1680074739752.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51565i2A443326A567ACD1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FN_1-1680074739752.png" alt="FN_1-1680074739752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In JSL, how can you move from the sensor data and hierarchy (inputs) to the asset table (desired output)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(output: asset data table)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FN_2-1680074878597.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51566i218DCD57D011540F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FN_2-1680074878597.png" alt="FN_2-1680074878597.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All tables and scripts are attached. Here is the input table script (metadata containing parent-child is added as column properties).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// New data table
dt = New Table( "sensor table" );

n_rows = 10;

n_additional_rows = 0;

// New column: Index
dt &amp;lt;&amp;lt; New Column( "Index", Numeric, "Continuous", Format( "Best", 12 ) ) &amp;lt;&amp;lt;
	Begin Data Update &amp;lt;&amp;lt; Add Rows( n_rows );

dt:Index &amp;lt;&amp;lt; Set Formula( Row() );

dt &amp;lt;&amp;lt; End Data Update;


// A sensor

dt &amp;lt;&amp;lt; New Column( "A sensor 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "A sensor 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "A sensor 3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; Group Columns( "A sensors", {:A sensor 1, :A sensor 2, :A sensor 3} )
	 &amp;lt;&amp;lt; Begin Data Update;

For Each Row(
		dt,
		:A sensor 1 = Random Normal( 0, 1 );
		:A sensor 2 = Random Normal( 0, 1 );
		:A sensor 3 = Random Normal( 0, 1 );
	);
	
dt &amp;lt;&amp;lt; End Data Update;

// B sensors

dt &amp;lt;&amp;lt; Add Rows( n_additional_rows );


dt &amp;lt;&amp;lt; New Column( "B sensor 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "B sensor 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	/*) &amp;lt;&amp;lt; New Column( "B sensor 3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected*/
	) &amp;lt;&amp;lt; Group Columns( "B sensors", {:B sensor 1, :B sensor 2}) //, :B sensor 3} )
	 &amp;lt;&amp;lt; Begin Data Update;

For Each Row(
		dt,
		:B sensor 1 = Random Normal( 0, 3 );
		:B sensor 2 = Random Normal( 0, 2 );
		//:B sensor 3 = Random Normal( 0, 3.5 );
	);
	
dt &amp;lt;&amp;lt; End Data Update;

colnames = dt &amp;lt;&amp;lt; Get Column Names( String );

for each({col, index}, colnames,
		column(dt, col) &amp;lt;&amp;lt; Set Property( "child", col ) );

// Calculations.

// New formula column: Stdev[A sensor ...r 2,A sensor 3]
dt &amp;lt;&amp;lt; New Column( "Stdev[A sensors]",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( Std Dev( :A sensor 1, :A sensor 2, :A sensor 3 ) ));
	
// Move selected column: Stdev[A sensors]
dt &amp;lt;&amp;lt;Move Selected Columns( {:"Stdev[A sensors]"n}, after( :A sensor 3 ) );
	
// New formula column: Stdev[A sensor ...r 2,A sensor 3]
dt &amp;lt;&amp;lt; New Column( "Stdev[B sensors]",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( Std Dev( :B sensor 1, :B sensor 2) ));//, :B sensor 3 ) ));
	
// Move selected column: Stdev[A sensors]
dt &amp;lt;&amp;lt;Move Selected Columns( {:"Stdev[B sensors]"n}, after( :B sensor 2 ) );

// Create metadata

For Each( {col, index}, {:A sensor 1, :A sensor 2, :A sensor 3},
		col &amp;lt;&amp;lt; Set Property( "parent", "A" ) &amp;lt;&amp;lt; Set Property( "parent_alias", "asset" )
	);


For Each( {col, index}, {:B sensor 1, :B sensor 2}, //, :B sensor 3},
		col &amp;lt;&amp;lt; Set Property( "parent", "B" ) &amp;lt;&amp;lt; Set Property( "parent_alias", "asset" )
	);

For Each( {col, index}, {:A sensor 1, :B sensor 1},
		col &amp;lt;&amp;lt; Set Property( "child_alias", "sensor 1" ) 
	);

For Each( {col, index}, {:A sensor 2, :B sensor 2},
		col &amp;lt;&amp;lt; Set Property( "child_alias", "sensor 2" ) 
	);


For Each( {col, index}, {:A sensor 3},//, :B sensor 3},
		col &amp;lt;&amp;lt; Set Property( "child_alias", "sensor 3" ) 
	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:28:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612324#M81245</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2023-06-08T16:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612427#M81254</link>
      <description>&lt;P&gt;Response removed to avoid future reader's confusion&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 14:22:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612427#M81254</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-03-15T14:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612435#M81255</link>
      <description>&lt;P&gt;Maybe something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
Names Default To Here( 1 );

//dt=open("input_example.jmp");

//Stack data table
Data Table( "input_example.jmp" ) &amp;lt;&amp;lt; Stack(
	columns( Column Group( "A sensors" ), Column Group( "B sensors" ) ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" ),
	Output Table( "Stacked Data" )
);

//Text to columns
Data Table( "Stacked Data" ) &amp;lt;&amp;lt; Text to Columns(
	columns( :Label ),
	Delimiters( " " )
);

//Delete column: Label 2
Data Table( "Stacked Data" ) &amp;lt;&amp;lt; Delete Columns( :Label 2 );

//Change column name: Label 1 → Asset
Data Table( "Stacked Data" ):Label 1 &amp;lt;&amp;lt; Set Name( "Asset" );

//Change column name: Label 3 → Sensor
Data Table( "Stacked Data" ):Label 3 &amp;lt;&amp;lt; Set Name( "Sensor" );

//New column: Column 6
Data Table( "Stacked Data" ) &amp;lt;&amp;lt; New Column( "Stddev of Sensor by Asset by Index",
	Numeric,
	"Continuous",
	Format( "Best", 12 )
);

//Change column formula: Stddev of Sensor by Asset by Index
Data Table( "Stacked Data" ):Stddev of Sensor by Asset by Index &amp;lt;&amp;lt;
Set Formula( Col Std Dev( :Data, :Asset, :Index ) );


//Report snapshot: Stacked Data - Graph Builder
Data Table( "Stacked Data" ) &amp;lt;&amp;lt; Graph Builder(
	Size( 517, 450 ),
	Show Control Panel( 0 ),
	Variables(
		X( :Index ),
		Y( :Stddev of Sensor by Asset by Index ),
		Overlay( :Asset )
	),
	Elements( Line( X, Y, Legend( 7 ) ), Points( X, Y, Legend( 8 ) ) )
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I used Worflow Builder in JMP 17 to "write" this script.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The key is using the "by" arguments in the formula. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Byron_JMP_0-1678885637805.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51075i1D72AC992B0A44BC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Byron_JMP_0-1678885637805.png" alt="Byron_JMP_0-1678885637805.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This lets me completly stack the data to have the complete hierarcy with the data all in one column.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I get the stddev of the whole column of data by asset and by index. That lets me make this graph:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Byron_JMP_1-1678885743642.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51076i197245C207DE5700/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Byron_JMP_1-1678885743642.png" alt="Byron_JMP_1-1678885743642.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 13:09:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612435#M81255</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2023-03-15T13:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612507#M81262</link>
      <description>&lt;P&gt;This is a good approach. Yet, a fully stacked table has the issue of being limited to those formulas that have a "by" argument.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if I wanted to do a formula that is: (sensor 1 - sensor 2) / sensor 3, the by-stacked table will be needed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 14:06:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612507#M81262</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2023-03-15T14:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612594#M81272</link>
      <description>&lt;P&gt;One option is to go pure JSL route if you do have the hierarchy table. Code might be able to explain itself:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt_hier = Open("$DOWNLOADS/hierarchy_example.jmp");
dt_input = Open("$DOWNLOADS/input_example.jmp");

// some assumptions:
	// both parents will have same amount of columns
new_col = dt_hier &amp;lt;&amp;lt; New Column("Data Cols", Character, Nominal, &amp;lt;&amp;lt; Set Each Value(
	Regex(:Child column, "sensor \d")
));
data_cols = Associative Array(new_col) &amp;lt;&amp;lt; get keys;
dt_hier &amp;lt;&amp;lt; Delete Column(new_col);

dt_collector = New Table("data",
	New Column("Index", Numeric, Ordinal),
	New Column("Group", Character, Nominal)
);
For Each({data_col}, data_cols,
	dt_collector &amp;lt;&amp;lt; New Column(data_col, Numeric, Continuous)
);

Summarize(dt_hier, parents = by(:Parent));
For Each({parent}, parents,
	parent_rows = Loc(dt_hier[0, "Parent"], parent);
	parent_cols = dt_hier[parent_rows, "Child column"];
	parent_data = dt_input[0, parent_cols]; 
	non_missing_idx = Loc(parent_data);
	row_count =  N Items(non_missing_idx) / n cols(parent_data);
	
	parent_data_clean = Shape(parent_data[non_missing_idx], row_count);
	
	first_row = N Rows(dt_collector) + 1;
	last_row = first_row + row_count - 1;
	dt_collector &amp;lt;&amp;lt; Add Rows(row_count);
	
	dt_collector[Index(first_row, last_row), "Index"] = Index(1, row_count)`;
	dt_collector[Index(first_row, last_row), "Group"] = Repeat({parent}, row_count);
	dt_collector[Index(first_row, last_row), data_cols] = parent_data_clean
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1678894014311.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51094iEF2EA6CE73EB29C4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1678894014311.png" alt="jthi_0-1678894014311.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Quite a few assumptions made here and no proper error handling&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 15:29:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/612594#M81272</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-03-15T15:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/617048#M81661</link>
      <description>&lt;P&gt;The hierarchy can be already in the table as metadata (column property).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have updated the example so you have parent (group), parent alias, child, and child alias embedded in the table.&lt;BR /&gt;&lt;BR /&gt;I think the most intuitive approach will be to stack the table by an asset (subset), split data by label, and then concatenate tables together.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 14:29:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/617048#M81661</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2023-03-28T14:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/617524#M81702</link>
      <description>&lt;P&gt;I have also simplified the requirements (no more empty values) and found a solution (stack, split, concat) that needs to be done iteratively (per asset). The hierarchy data is now embedded in the main table (progress can be found in the input_example).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 15:35:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/617524#M81702</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2023-03-28T15:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking in JSL indexed columns by group (sensor data and assets)</title>
      <link>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/621969#M82095</link>
      <description>&lt;P&gt;The most straightforward operation I found was by automating these data steps.&lt;BR /&gt;&lt;BR /&gt;1) Stack&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="01_stack.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51905iD2C29893BC467DDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="01_stack.png" alt="01_stack.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; 2) Split&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="02_split.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51906i072B1FEA753DD3A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="02_split.png" alt="02_split.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3) Concatenate&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FN_0-1681321349031.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51907i594AACDA424DF01A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FN_0-1681321349031.png" alt="FN_0-1681321349031.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 17:44:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stacking-in-JSL-indexed-columns-by-group-sensor-data-and-assets/m-p/621969#M82095</guid>
      <dc:creator>FN</dc:creator>
      <dc:date>2023-04-12T17:44:43Z</dc:date>
    </item>
  </channel>
</rss>

