cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Pearl
Level II

JMP scripting - Double FOR loop: H List Box and V List Box

Hi everyone,

I started to learn scripting and I'm trying to do a Window with 6 scatteplot: 2 vertical + 3 horizontal.

I've tried a double for loop but I don't know why it doesn't work. It gives no error but I cannot get the images.The code is:

BladeList = List( "Blade8", "Blade61", "Blade74" );

New Window( "Oneway Advisor",
	H List Box(
		For( j = 1, j <= 2, j++,
			V List Box(
				For( i = 1, i <= 3, i++,
					Write(i);
					Scatterplot 3D(
						Y( :Name( " x" ), :y, :z ),
						Coloring( :Name( " Mean Io" ) ),
						Legend( 1522 ),
						Frame3D(
							Legend( 1 ),
							Set Grab Handles( 0 ),
							Set Rotation( -64, 0, -41 ),
							Set Marker Scale( 5.2652 )
						),
						Where( :Blade == BladeList[i] & :Embodiment == "THP" ),
						SendToReport(
							Dispatch(
								{},
								"100",
								ScaleBox,
								{Legend Model(
									1522,
									Properties(
										0,
										{gradient( {Color Theme( "Jet" )} )},
										Item ID( " Mean Io", 1 )
									)
								)}
							)
						)
					)
				);
			),
		);
	);
);

However if I try a single loop it works:

BladeList = List( "Blade8", "Blade61", "Blade74" );

New Window( "Oneway Advisor",
	H List Box(
		/*For( j = 1, j <= 2, j++,*/
			V List Box(
				For( i = 1, i <= 3, i++,
					Write(i);
					Scatterplot 3D(
						Y( :Name( " x" ), :y, :z ),
						Coloring( :Name( " Mean Io" ) ),
						Legend( 1522 ),
						Frame3D(
							Legend( 1 ),
							Set Grab Handles( 0 ),
							Set Rotation( -64, 0, -41 ),
							Set Marker Scale( 5.2652 )
						),
						Where( :Blade == BladeList[i] & :Embodiment == "THP" ),
						SendToReport(
							Dispatch(
								{},
								"100",
								ScaleBox,
								{Legend Model(
									1522,
									Properties(
										0,
										{gradient( {Color Theme( "Jet" )} )},
										Item ID( " Mean Io", 1 )
									)
								)}
							)
						)
					)
				);
			),
						V List Box(
				For( i = 1, i <= 3, i++,
					Write(i);
					Scatterplot 3D(
						Y( :Name( " x" ), :y, :z ),
						Coloring( :Name( " Mean Io" ) ),
						Legend( 1522 ),
						Frame3D(
							Legend( 1 ),
							Set Grab Handles( 0 ),
							Set Rotation( -64, 0, -41 ),
							Set Marker Scale( 5.2652 )
						),
						Where( :Blade == BladeList[i] & :Embodiment == "THP" ),
						SendToReport(
							Dispatch(
								{},
								"100",
								ScaleBox,
								{Legend Model(
									1522,
									Properties(
										0,
										{gradient( {Color Theme( "Jet" )} )},
										Item ID( " Mean Io", 1 )
									)
								)}
							)
						)
					)
				);
			),
		/*);*/
	);
);

Can anyone help me with this.

Thank you,

David

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JMP scripting - Double FOR loop: H List Box and V List Box

I was not able to get the double loop to work, however, the below method will get you he results you want

BladeList = List( "Blade8", "Blade61", "Blade74" );

New Window( "Oneway Advisor",
	hlb = H List Box()
);
For( j = 1, j <= 2, j++,
	vlb = V List Box(
		For( i = 1, i <= 3, i++,
			sc = Scatterplot 3D(
				invisible,
				Y( :Name( " x" ), :y, :z ),
				Coloring( :Name( " Mean Io" ) ),
				Legend( 1522 ),
				Frame3D(
					Legend( 1 ),
					Set Grab Handles( 0 ),
					Set Rotation( -64, 0, -41 ),
					Set Marker Scale( 5.2652 )
				),
				Where( :Blade == BladeList[i] & :Embodiment == "THP"  ),
				SendToReport(
					Dispatch(
						{},
						"100",
						ScaleBox,
						{Legend Model(
							1522,
							Properties( 0, {gradient( {Color Theme( "Jet" )} )}, Item ID( " Mean Io", 1 ) )
						)}
					)
				)
			), 
		)
	);
	hlb << append( vlb );
);
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: JMP scripting - Double FOR loop: H List Box and V List Box

I was not able to get the double loop to work, however, the below method will get you he results you want

BladeList = List( "Blade8", "Blade61", "Blade74" );

New Window( "Oneway Advisor",
	hlb = H List Box()
);
For( j = 1, j <= 2, j++,
	vlb = V List Box(
		For( i = 1, i <= 3, i++,
			sc = Scatterplot 3D(
				invisible,
				Y( :Name( " x" ), :y, :z ),
				Coloring( :Name( " Mean Io" ) ),
				Legend( 1522 ),
				Frame3D(
					Legend( 1 ),
					Set Grab Handles( 0 ),
					Set Rotation( -64, 0, -41 ),
					Set Marker Scale( 5.2652 )
				),
				Where( :Blade == BladeList[i] & :Embodiment == "THP"  ),
				SendToReport(
					Dispatch(
						{},
						"100",
						ScaleBox,
						{Legend Model(
							1522,
							Properties( 0, {gradient( {Color Theme( "Jet" )} )}, Item ID( " Mean Io", 1 ) )
						)}
					)
				)
			), 
		)
	);
	hlb << append( vlb );
);
Jim
Pearl
Level II

Re: JMP scripting - Double FOR loop: H List Box and V List Box

Thank you very much txnelson for your help! It works perfectly.
Evan_Morris
Level IV

Re: JMP scripting - Double FOR loop: H List Box and V List Box

I know this is a bit of an old thread to bring back, but I can't tell what was the fundamental change between the two sets of code that fixed the nested loop issue. I'm getting an error in one of my tools using a nested loop, I'm hoping it is related.

 

Edit:  Is it just a matter of using that HLB append functionality?