<?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 Re: Create a tab box with a cross tab box design in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42218#M24601</link>
    <description>&lt;P&gt;Ah, yes. The Insert Into functionality for DisplayBoxes was not added until JMP 13. Glad to hear this will work for you.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2017 13:09:20 GMT</pubDate>
    <dc:creator>Justin_Chilton</dc:creator>
    <dc:date>2017-07-20T13:09:20Z</dc:date>
    <item>
      <title>Create a tab box with a cross tab box design</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42138#M24554</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure this is possible, but I try my luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create (in jsl) kind of a cross tab box, but customized with my own values. To make myself better understood:&lt;/P&gt;&lt;P&gt;Here is a tabulate (FIG. 1) containing the data I want to display:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="FIG. 1 - Tabulate" style="width: 714px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/6840iF9BE5209A840C29C/image-size/large?v=v2&amp;amp;px=999" role="button" title="wea00061 - Connexion Bureau à distance_4.jpg" alt="FIG. 1 - Tabulate" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;FIG. 1 - Tabulate&lt;/span&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;This is fine, but not quite what I want. What I would like to obtain is something similar to the cross tab box we get when calling a contingency analysis, such as in FIG.2:&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="FIG.2 - contingency table" style="width: 266px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/6839i03A87D8238253749/image-size/medium?v=v2&amp;amp;px=400" role="button" title="wea00061 - Connexion Bureau à distance_3.jpg" alt="FIG.2 - contingency table" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;FIG.2 - contingency table&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;BUT instead of "Count", "Total%" and so on, I would put into the cells the mean values that correspond to my&amp;nbsp;analysis columns in tabulate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The features I like in this design and which I don't have in the tabulate version are :&lt;/P&gt;&lt;P&gt;- the possibility to display&amp;nbsp;several values in&amp;nbsp;one cell (and display legend in the top left hand corner)&lt;/P&gt;&lt;P&gt;- the shade on columns AND rows headers&lt;/P&gt;&lt;P&gt;- the absence of the "mean" line under the column headers&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I couldn't find a way of converting my tabulate into what I want using tab box. Do you think it would be possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:24:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42138#M24554</guid>
      <dc:creator>heloiseheraud</dc:creator>
      <dc:date>2023-06-09T23:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create a tab box with a cross tab box design</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42150#M24559</link>
      <description>&lt;P&gt;You can fairly easily recreate the Tabulate using a TableBox and ColSpan Boxes. See below for an example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Col Span Box",
	Table Box(
		Number Col Box( "CAT_ECH", {1, 2, 3} ),
		Col Span Box(
			"CAT_MK",
			Col Span Box(
				"0-100",
				Col Span Box("COUT_TOT_ENVIRONNE",Number Col Box( "Mean", {1, 2, 3} )),
				Col Span Box("TEMPS",Number Col Box( "Mean", {1, 2, 3} )),
				Col Span Box("COUT_CONSOS",Number Col Box( "Mean", {1, 2, 3} ))
			),
			Col Span Box(
				"&amp;gt;=100",
				Col Span Box("COUT_TOT_ENVIRONNE",Number Col Box( "Mean", {1, 2, 3} )),
				Col Span Box("TEMPS",Number Col Box( "Mean", {1, 2, 3} )),
				Col Span Box("COUT_CONSOS",Number Col Box( "Mean", {1, 2, 3} ))
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is what the Col Span Box method looks like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Col Span Box.PNG" style="width: 855px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/6845iB69DA6AC87910B46/image-size/large?v=v2&amp;amp;px=999" role="button" title="Col Span Box.PNG" alt="Col Span Box.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Since the CrossTabBox DisplayBox is not scriptable using JSL, you would need to use a different method to recreate something like what is used in the Contingency platform.&lt;/P&gt;
&lt;P&gt;You can do this using a concept I have been working on to use a LineupBox to create your own custom tables. This method uses a custom function for the creation of each cell to avoid a lot of code duplication. See my comments for details.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
//helper function to create cells in the lineupBOx "table"
getCell = Function( {values, altShading, justify = "left"},
	{Default Local}, 
	
	// Create a lineup box to add each of the values to
	lb = Lineup Box( N Col( 1 ), SPacing( 0 ) ); // 1 column and no spacing
	
	// loop through and add each value
	For( i = 1, i &amp;lt;= N Items( values ), i++, 
	
		// if justify is left, put the spacer box on the right, otherwise, put it on the left
		If( justify == "left", 
			// borderBox to give values some spacing (and for shading)
			b = Border Box( Right( 5 ), Left( 5 ), top( 1 ), bottom( 1 ),
				H List Box(
					//Text box with current value
					Text Box( values[i] ),
					// Spacing to fill the cell shading all the way to the right (will grow horizontally, but not vertially)
					Spacer Box( &amp;lt;&amp;lt;Set Max Size( 99999, 0 ) )
				)
			)
		,
			b = Border Box( Right( 5 ), Left( 5 ), top( 1 ), bottom( 1 ),
				H List Box(
					// Spacing to right align the text. the spacer will grow horizontally, but not vertially)
					Spacer Box( &amp;lt;&amp;lt;Set Max Size( 99999, 0 ) ),
					
					//Text box with current value
					Text Box( values[i] )
				)
			)
		);
		
		// if altShading is turned on
		If( altShading == 1,
		
			// check if this is an even numbered row
			If( Mod( i, 2 ) == 0,
				//set the background color to a light-gray
				b &amp;lt;&amp;lt; Background color( RGB Color( 225, 225, 225 ) )
			),
			
			//when altShading is off, we set the background color to a light-gray for all values
			b &amp;lt;&amp;lt; Background color( RGB Color( 225, 225, 225 ) )
		);
		
		// Add the BorderBox to the LineupBox
		Insert Into( lb, b );
	);
	
	// Return the LineupBox with a Border with lines around it
	Return(
		Border Box( Right( 0 ), Left( 0 ), top( 0 ), bottom( 0 ), sides( 15 ),
			lb
		)
	);
	
);

New Window( "Custom Table",
	Outline Box( "Custom Table",
		Border Box( Right( 5 ), Left( 5 ), top( 5 ), bottom( 5 ),
			H List Box(
				V Center Box( Text Box( "CAT_ECH", &amp;lt;&amp;lt;Rotate Text( "left" ) ) ),
				V List Box(
					H Center Box( Text Box( "CAT_MK" ) ),
					Lineup Box( N Col( 4 ), spacing( 0 ), 
						
						//Row 1
						getCell( {"Count", "Total %", "Col %", "Row %"}, 1 ),
						getCell( {"0-100", "", "", ""}, 0 ),
						getCell( {"&amp;gt;=100", "", "", ""}, 0 ),
						getCell( {"Total", "", "", ""}, 0 ), 
					
						//Row 2
						getCell( {"0-250", "", "", ""}, 0 ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ), 
					
						//Row 3
						getCell( {"250-3000", "", "", ""}, 0 ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ), 
					
						//Row 4
						getCell( {"&amp;gt;=3000", "", "", ""}, 0 ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ),
						getCell( {"13", "30.95", "43.33", "68.42"}, 1, "Right" ), 
					
						//Row 5
						getCell( {"Total", ""}, 0 ),
						getCell( {"13", "30.95"}, 1, "Right" ),
						getCell( {"13", "30.95"}, 1, "Right" ),
						getCell( {"13", "30.95"}, 1, "Right" )
					)
				)
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is what the resulting window will look like with this method:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Custom Table.PNG" style="width: 289px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/6846i8D501EA20DA0A46D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Custom Table.PNG" alt="Custom Table.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:25:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42150#M24559</guid>
      <dc:creator>Justin_Chilton</dc:creator>
      <dc:date>2017-07-19T15:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create a tab box with a cross tab box design</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42214#M24598</link>
      <description>&lt;P&gt;Very nice! Thank you! I surely will use this code template a lot!!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 12:17:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42214#M24598</guid>
      <dc:creator>heloiseheraud</dc:creator>
      <dc:date>2017-07-20T12:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create a tab box with a cross tab box design</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42216#M24600</link>
      <description>&lt;P&gt;Just one thing though, in your function I had to change the line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Add the BorderBox to the LineupBox
		Insert Into( lb, b );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;into:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Add the BorderBox to the LineupBox
		lb &amp;lt;&amp;lt; Append( b );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;to make it work, otherwise I got nothing displayed.&lt;BR /&gt;&lt;BR /&gt;I definitely love your work!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 12:31:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42216#M24600</guid>
      <dc:creator>heloiseheraud</dc:creator>
      <dc:date>2017-07-20T12:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create a tab box with a cross tab box design</title>
      <link>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42218#M24601</link>
      <description>&lt;P&gt;Ah, yes. The Insert Into functionality for DisplayBoxes was not added until JMP 13. Glad to hear this will work for you.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 13:09:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-a-tab-box-with-a-cross-tab-box-design/m-p/42218#M24601</guid>
      <dc:creator>Justin_Chilton</dc:creator>
      <dc:date>2017-07-20T13:09:20Z</dc:date>
    </item>
  </channel>
</rss>

