<?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 Extract the data from data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Extract-the-data-from-data-table/m-p/37839#M22167</link>
    <description>&lt;P&gt;hi, all&lt;BR /&gt;I now need to create the tabs which is based on my data table(i named as dt2). The names of the tabs is based on the dt2, meant here: if dt2 has 10 products name, so in my interface i also need have 10 tabs&amp;nbsp;which is based on the product names in dt2.&lt;BR /&gt;One of my requirement is i cannot hardcode the coding, because in the future, maybe i need to add in the name of products in dt2, so the tabs will auto have same with the number of products name in dt2.&lt;/P&gt;
&lt;P&gt;So, how to pull the data from dt2 and make it as tabs?&lt;BR /&gt;Actually i don't know how to write the code for the task that i need complete, i have try many times, but its keep runs out errors.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dt2&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="photo 1.png" style="width: 374px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5802iCC5CE85CB6E7FAA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="photo 1.png" alt="photo 1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dt2 = Data Table(
	"Data Table........") &amp;lt;&amp;lt; Summary( 
	Group( :F D ), 
	Freq( "None" ), 
	Weight( "None" ),
	invisible	
	);   


//Create Tabs based on the F D
VariabilityWindow = New Window("Variability Chart",tb = Tab Box() );

For(i =1, i &amp;lt;=nTabs(dt2 &amp;lt;&amp;lt; get row names()), i++,
	tb &amp;lt;&amp;lt; insert(
		dt2: F D[i] || Char(i),
		V list Box(
			Button Box("Variability Chart #" || Char(i)),
		)
		
	)
	);&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Apr 2017 13:48:51 GMT</pubDate>
    <dc:creator>blue1994</dc:creator>
    <dc:date>2017-04-06T13:48:51Z</dc:date>
    <item>
      <title>Extract the data from data table</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-the-data-from-data-table/m-p/37839#M22167</link>
      <description>&lt;P&gt;hi, all&lt;BR /&gt;I now need to create the tabs which is based on my data table(i named as dt2). The names of the tabs is based on the dt2, meant here: if dt2 has 10 products name, so in my interface i also need have 10 tabs&amp;nbsp;which is based on the product names in dt2.&lt;BR /&gt;One of my requirement is i cannot hardcode the coding, because in the future, maybe i need to add in the name of products in dt2, so the tabs will auto have same with the number of products name in dt2.&lt;/P&gt;
&lt;P&gt;So, how to pull the data from dt2 and make it as tabs?&lt;BR /&gt;Actually i don't know how to write the code for the task that i need complete, i have try many times, but its keep runs out errors.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dt2&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="photo 1.png" style="width: 374px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5802iCC5CE85CB6E7FAA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="photo 1.png" alt="photo 1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dt2 = Data Table(
	"Data Table........") &amp;lt;&amp;lt; Summary( 
	Group( :F D ), 
	Freq( "None" ), 
	Weight( "None" ),
	invisible	
	);   


//Create Tabs based on the F D
VariabilityWindow = New Window("Variability Chart",tb = Tab Box() );

For(i =1, i &amp;lt;=nTabs(dt2 &amp;lt;&amp;lt; get row names()), i++,
	tb &amp;lt;&amp;lt; insert(
		dt2: F D[i] || Char(i),
		V list Box(
			Button Box("Variability Chart #" || Char(i)),
		)
		
	)
	);&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 13:48:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-the-data-from-data-table/m-p/37839#M22167</guid>
      <dc:creator>blue1994</dc:creator>
      <dc:date>2017-04-06T13:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the data from data table</title>
      <link>https://community.jmp.com/t5/Discussions/Extract-the-data-from-data-table/m-p/37841#M22168</link>
      <description>&lt;P&gt;It is obvious that you are still struggling with the very basic parts of JSL. &amp;nbsp;A couple of pointers, based upon the code you are showing.&lt;/P&gt;
&lt;P&gt;1. &amp;nbsp;Don't make up code. &amp;nbsp;When it doesn't work, it is just confusing. &amp;nbsp;When guessing at code works, you don't know why, and you haven't learned anything.&lt;/P&gt;
&lt;P&gt;2. Use the Log. &amp;nbsp;In your many discussions that you have listed, I have not seen results from the log. &amp;nbsp;These messages provide great detail and insight on what is going wrong with your JSL.&lt;/P&gt;
&lt;P&gt;3. Use &lt;STRONG&gt;Help==&amp;gt;Scripting Index.&amp;nbsp;&lt;/STRONG&gt;It provides the correct syntax and examples&amp;nbsp;on how the items work. &amp;nbsp;The Scripting Index is the most complete documentation on JSL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me critique your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2 = Data Table(
	"Data Table........") &amp;lt;&amp;lt; Summary( 
	Group( :F D ), 
	Freq( "None" ), 
	Weight( "None" ),
	invisible	
	);   
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The description of the Summary Platform is found at:&lt;/P&gt;
&lt;P&gt;Help==Scripting Index==&amp;gt;Data Table==&amp;gt;Summary&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="summary doc.PNG" style="width: 893px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/5803i9E6392360C6BF908/image-size/large?v=v2&amp;amp;px=999" role="button" title="summary doc.PNG" alt="summary doc.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here is an example almost itdentical to what is needed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; Summary( Group( :Age ), Mean( :Height ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But what seems to be missing is how to create a pointer to the summary table that will be produced by the Summary Platform. &amp;nbsp;However, you don't seem to understand how to reference data tables. &amp;nbsp;In the example, the variable "dt" points to the data table opened. &amp;nbsp;So as can be seen it is used when the Summary Platform references it. &amp;nbsp;However, you can also use a Data Table() function to point to the physical name of a data table. &amp;nbsp;Which is kind of what I think you are trying to do, with Data Table("Data Table............."). &amp;nbsp;Either one will work.......if you know the name of the data table. &amp;nbsp;But as you are showing in your provided code, make sure you specify a variable to point to the data table you will be creating from the Summary Platform, so you can use it in your next step ( i.e. dt = )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next section of code appears that you were just guessing at syntax. &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Create Tabs based on the F D
VariabilityWindow = New Window("Variability Chart",tb = Tab Box() );

For(i =1, i &amp;lt;=nTabs(dt2 &amp;lt;&amp;lt; get row names()), i++,
	tb &amp;lt;&amp;lt; insert(
		dt2: F D[i] || Char(i),
		V list Box(
			Button Box("Variability Chart #" || Char(i)),
		)
		
	)
	);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What you are trying to do is to generate a new tab for each Value of F D from the summary data table.&lt;/P&gt;
&lt;P&gt;A search of the Scripting Index shows that nothing by the name of nTabs or get row names() exists. &amp;nbsp;I assume you were thinking that nTabs would give you the number of tabls you want. &amp;nbsp;Which it cannot, since at this point in the program, no tabls have been produced, and just because a summary table has been produced, it would have know idea that the number of rows in the data table are the number of tabs you want to product. &amp;nbsp;However, you can look into the Scripting Index and see what functions will tell you the number of rows there are in a data table "N Rows()" and simply change the made up code for N Rows() and you will have your solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code is making the assumption that your original data table has a pointer variable called "dt" that is pointing to it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2 = dt &amp;lt;&amp;lt; Summary( Group( :F D ), Freq( "None" ), Weight( "None" ), invisible );   


//Create Tabs based on the F D
VariabilityWindow = New Window( "Variability Chart", tb = Tab Box() );

For( i = 1, i &amp;lt;= nrows( dt2 ), i++,
	tb &amp;lt;&amp;lt; Insert(
		dt2:F D[i] || Char( i ),
		V List Box( Button Box( "Variability Chart #" || Char( i ) ), )
		
	)
);



dt2 = Data Table(
	"Data Table........") &amp;lt;&amp;lt; Summary( 
	Group( :F D ), 
	Freq( "None" ), 
	Weight( "None" ),
	invisible	
	); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 05:05:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extract-the-data-from-data-table/m-p/37841#M22168</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-04-06T05:05:12Z</dc:date>
    </item>
  </channel>
</rss>

