BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
kuannygoh
Occasional Contributor

Unable to rename tab page using array

Hi all , 

I tried to use array to rename a tab page but it fails to do so, can someone tell me what is the problem ?

step[i] seems not working to rename the tab page. 

step = {};
step = {1,2,3,4};

New Window( "Example", nwbb = Tab Box() );

For( i = 1, i <= n Items(step), i++,
	nwbb <<add(
		Tab Page Box(
			char(step[i]) ,
			TB = Tab Box(
				Tab Page Box(
					"Summary",
					
						Data Table To Table Box(dt)
					
				),
				Tab Page Box(
					"Pareto Chart",
					ob1 = Outline Box( "Pareto Chart",
						dt << Distribution( Column( :Height, :Weight ), By( :sex ) )
					)
				)
				
			)
		)
	);
0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
uday_guntupalli
Community Trekker

Re: Unable to rename tab page using array

@kuannygoh,
      A couple of things that I notice when I try to run your code are : 

1. Your parantheses are unbalanced.

2. Data Table To Table Box -  I am not aware of this function in JMP

 

Thanks to Discovery Summit ( I believe this was @pmroz's work) - there is an example that I can pull out of the hat for tabbed boxes. Your problem may not be linked to naming, unless you are seeing something else. If you are - please share your log and a snapshot of what your concern is 

 

dt    = open("$sample_data\Candy Bars.jmp", invisible);
xcol  = "Calories";
ycols = {"Total fat g", "Saturated fat g", "Cholesterol g"};

gw = new window("Graphical Output",
	outlinebox(xcol || " vs:",
		tb = tab box()
	)
);

for(i = 1, i <= nitems(ycols), i++,
	ycol = ycols[i];
	tb << add(ycol, vlistbox(
		dt << Graph Builder(
			Size( 530, 450 ),
			Show Control Panel( 0 ),
			Variables( X( as column( xcol ) ), Y( as column( ycol ) ) ),
			Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
		),
	));

);
Best
Uday
0 Kudos
2 REPLIES 2
uday_guntupalli
Community Trekker

Re: Unable to rename tab page using array

@kuannygoh,
      A couple of things that I notice when I try to run your code are : 

1. Your parantheses are unbalanced.

2. Data Table To Table Box -  I am not aware of this function in JMP

 

Thanks to Discovery Summit ( I believe this was @pmroz's work) - there is an example that I can pull out of the hat for tabbed boxes. Your problem may not be linked to naming, unless you are seeing something else. If you are - please share your log and a snapshot of what your concern is 

 

dt    = open("$sample_data\Candy Bars.jmp", invisible);
xcol  = "Calories";
ycols = {"Total fat g", "Saturated fat g", "Cholesterol g"};

gw = new window("Graphical Output",
	outlinebox(xcol || " vs:",
		tb = tab box()
	)
);

for(i = 1, i <= nitems(ycols), i++,
	ycol = ycols[i];
	tb << add(ycol, vlistbox(
		dt << Graph Builder(
			Size( 530, 450 ),
			Show Control Panel( 0 ),
			Variables( X( as column( xcol ) ), Y( as column( ycol ) ) ),
			Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
		),
	));

);
Best
Uday
0 Kudos
txnelson
Super User

Re: Unable to rename tab page using array

JMP is not handling the tab name as an item that can be evaluated prior to interpreting it, therefore, the methodology I tend to use, is to generate the statement one requires, using a Substitution() function, which presents to the JMP interpreter, an fully filled in code stream.  The sample below handles what you want:

step = {};
step = {1, 2, 3, 4};

New Window( "Example", nwbb = Tab Box() );

For( i = 1, i <= N Items( step ), i++,
	Eval(
		Substitute(
				Expr(
					nwbb << Add(
						Tab Page Box(
							__step__,
							TB = Tab Box(
								Tab Page Box(
									"Summary", 
					
									Data Table To Table Box(dt)
					
								),
								Tab Page Box(
									"Pareto Chart",
									ob1 = Outline Box( "Pareto Chart",
										dt << Distribution( Column( :Height, :Weight ), By( :sex ) )
									)
								)
				
							)
						)
					)
				),
			Expr( __step__ ), Char( step[i] )
		)
	)
);
Jim