cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
RahBarroso
Level II

How to edit Number Col Edit Boxes in the Custom Profiler

Hello, 

 

I'm working on a project where I want to have users calculate values in a separate custom window that is then transmitted to the custom profiler to change the values held in their from the prediction formula in a data table. I'm stuck on trying to edit the NumberColEdit Boxes in the custom profiler, I can get the string list out, but not sure how to change the first string value and have it brought back into the box.

 

I have a simplified example here, where the custom profiler is created and a separate window is made with a button to press - I want this button to change the second value in the string list to '185' (in the actual final tool, the user will calculate a value in the second window that I want transmitted to the first X position in the custom profiler).

 

Thanks!

 

New Table( "Coffee Data",
	Add Rows( 12 ),
	New Table Variable(
		["en" => "Design",
		"ja" => "計画",
		"x-id" => "S_Design_Experiment_Coffee_Data_Design_2_Var",
		"zh-CN" => "设计"],
		["en" => "Custom Design",
		"ja" => "カスタム計画",
		"x-id" => "S_Design_Experiment_Coffee_Data_Custom_Design_2_Txt",
		"zh-CN" => "定制设计"]
	),
	New Table Variable(
		["en" => "Criterion",
		"ja" => "基準",
		"x-id" => "S_Design_Experiment_Coffee_Data_Criterion_2_Var",
		"zh-CN" => "准则"],
		["en" => "D Optimal",
		"ja" => "D-最適計画",
		"x-id" => "S_Design_Experiment_Coffee_Data_D_Optimal_Txt",
		"zh-CN" => "D 最优"]
	),
	New Table Variable( "Notes",
		["en" =>
		"These data are from an experiment performed at a coffee roasting company. Coffee Factors.jmp provides the factors and settings.",
		"ja" => "コーヒー豆焙煎所で行った実験のデータ。「Coffee Factors.jmp」に因子と設定がまとめられている。",
		"x-id" =>
		"S_Design_Experiment_Coffee_Factors_These_are_the_factors_and_values_Txt",
		"zh-CN" => "这些数据来自一家咖啡烘焙公司执行的实验。Coffee Factors.jmp 提供了因子和设置。"]
	),
	New Script(
		["en" => "Model",
		"ja" => "モデル",
		"x-id" => "S_Design_Experiment_Coffee_Data_Model_2_Scp",
		"zh-CN" => "模型"],
		Fit Model(
			Effects( :Grind, :Temperature, :Time, :Charge, :Station ),
			Y( :Strength )
		)
	),
	New Script(
		["en" => "Evaluate Design",
		"ja" => "計画の評価",
		"x-id" => "S_Design_Experiment_Coffee_Data_Evaluate_Design_Scp",
		"zh-CN" => "评估设计"],
		DOE( Evaluate Design, X( :Grind, :Temperature, :Time, :Charge, :Station ) )
	),
	New Script(
		["en" => "Generalized Regression",
		"ja" => "一般化回帰",
		"x-id" => "S_Design_Experiment_Coffee_Data_Generalized_Regression_Scp",
		"zh-CN" => "广义回归"], JSL Quote(If(jmp product name() =="Pro",
	Fit Model(
		Y( :Strength ),
		Effects( :Grind, :Temperature, :Time, :Charge, :Station ),
		Personality( Generalized Regression ),
		Generalized Distribution( Normal ),
		Run(
			Fit(
				Estimation Method(
					Forward Selection(
						Initial Displayed Solution( Biggest in Green Zone )
					)
				),
				Validation Method( AICc ),
				Enforce Heredity
			)
		)
	),
    //else, product is not JMP Pro, notify user    
	lang = jmp host information()[5];
    title = match(lang,
            "Spanish", "Se requiere JMP Pro",
            "German", "JMP Pro erforderlich",
            "Italian", "JMP Pro è obbligatorio",
            "French", "JMP Pro nécessaire",
            "Japanese", "JMP Proが必要",
            "Simplified Chinese", "需要 JMP Pro",
            "Korean", "JMP Pro 필요",
            "JMP Pro Required");
    msg = match(lang,
            "Spanish", "Este script requiere JMP Pro para ejecutarse correctamente.",
            "German", "Dieses Script benötigt JMP Pro um ausgeführt zu werden.",
            "Italian", "Questo script necessita di JMP PRO per essere eseguito correttamente.",
            "French", "Ce script a besoin de JMP Pro pour fonctionner correctement.",
            "Japanese", "このスクリプトを正しく動作させるにはJMP Proが必要です。",
            "Simplified Chinese", "该脚本需要 JMP Pro 才能成功执行。",
            "Korean", "이 스크립트를 성공적으로 수행하기 위해서는 JMP Pro가 필요합니다.",
            "This script requires JMP Pro to execute successfully.");
	print(msg);
	New Window( title, <<Modal, Text Box(msg) )
);
)	,
		As String( 1 )
	),
	New Script(
		["en" => "DOE Dialog",
		"ja" => "DOEダイアログ",
		"x-id" => "S_Design_Experiment_Coffee_Data_DOE_Dialog_2_Scp",
		"zh-CN" => "实验设计对话框"],
		DOE(
			Custom Design,
			{Add Response( Match Target, "Strength", 1.2, 1.3999999999999999, . ),
			Add Factor( Categorical, {"Coarse", "Medium"}, "Grind", 0 ),
			Add Factor( Continuous, 195, 205, "Temperature", 0 ),
			Add Factor( Continuous, 3, 4, "Time", 0 ),
			Add Factor(
				Continuous, 1.6000000000000001, 2.3999999999999999, "Charge", 0
			), Add Factor( Blocking, 4, "Station" ), Set Random Seed( 569534903 ),
			Number of Starts( 100 ), Add Term( {1, 0} ), Add Term( {1, 1} ),
			Add Term( {2, 1} ), Add Term( {3, 1} ), Add Term( {4, 1} ),
			Add Term( {5, 1} ), Add Alias Term( {1, 1}, {2, 1} ),
			Add Alias Term( {1, 1}, {3, 1} ), Add Alias Term( {1, 1}, {4, 1} ),
			Add Alias Term( {2, 1}, {3, 1} ), Add Alias Term( {2, 1}, {4, 1} ),
			Add Alias Term( {3, 1}, {4, 1} ), Set Sample Size( 12 ), Make Design}
		)
	),
	New Script(
		["en" => "Reduced Model",
		"ja" => "縮小モデル",
		"x-id" => "S_Design_Experiment_Coffee_Data_Reduced_Model_2_Scp",
		"zh-CN" => "简化模型"],
		Fit Model(
			Y( :Strength ),
			Effects( :Time, :Charge, :Station ),
			Keep dialog open( 1 ),
			Personality( "Standard Least Squares" ),
			Emphasis( "Effect Screening" )
		)
	),
	New Script(
		"Custom Profiler of Pred Formula Strength",
		Custom Profiler(
			Y( :Pred Formula Strength ),
			Custom Profiler(
				1,
				Term Value(
					:Grind( "Medium", Lock( 0 ), Show( 1 ) ),
					:Temperature( 180, Min( 180 ), Lock( 0 ), Show( 1 ) ),
					:Time( 3.5, Lock( 0 ), Show( 1 ) ),
					:Charge( 2, Lock( 0 ), Show( 1 ) ),
					:Station( "1", Lock( 0 ), Show( 1 ) )
				),
				Objective Formula( :Pred Formula Strength )
			)
		)
	),
	New Column(
		["en" => "Grind",
		"ja" => "挽き",
		"x-id" => "S_Design_Experiment_Coffee_Data_Grind_2_Col",
		"zh-CN" => "研磨"],
		Character( 6 ),
		"Nominal",
		Set Property( "Design Role", DesignRole( Categorical ) ),
		Set Property( "Factor Changes", Easy ),
		Set Property(
			"Notes",
			["en" => "Coarseness of the ground beans",
			"ja" => "挽いた豆の粗さ",
			"x-id" =>
			"S_Design_Experiment_Coffee_Data_Coarseness_of_the_ground_beans_2_Not",
			"zh-CN" => "咖啡豆研磨的粗细程度"]
		),
		Set Property( "Value Order", {Custom Order( {"Coarse", "Medium"} )} ),
		Set Values(
			{"Medium", "Coarse", "Medium", "Coarse", "Coarse", "Medium", "Medium",
			"Coarse", "Coarse", "Coarse", "Medium", "Medium"}
		),
		Set Display Width( 0 )
	),
	New Column(
		["en" => "Temperature",
		"ja" => "温度",
		"x-id" => "S_Design_Experiment_Coffee_Data_Temperature_2_Col",
		"zh-CN" => "温度"],
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Coding", {195, 205} ),
		Set Property( "Design Role", DesignRole( Continuous ) ),
		Set Property( "Factor Changes", Easy ),
		Set Property(
			"Notes",
			["en" =>
			"Temperature of the water used to brew the coffee (in degrees Fahrenheit)",
			"ja" => "コーヒーの抽出に使った湯の温度(華氏)",
			"x-id" =>
			"S_Design_Experiment_Coffee_Data_Temperature_of_the_water_used_to_2_Not",
			"zh-CN" => "冲泡咖啡的水温度(华氏度)"]
		),
		Set Values( [205, 195, 205, 195, 205, 195, 195, 205, 205, 195, 195, 205] ),
		Set Display Width( 0 )
	),
	New Column(
		["en" => "Time",
		"ja" => "時間",
		"x-id" => "S_Design_Experiment_Coffee_Data_Time_2_Col",
		"zh-CN" => "时间"],
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Coding", {3, 4} ),
		Set Property( "Design Role", DesignRole( Continuous ) ),
		Set Property( "Factor Changes", Easy ),
		Set Property(
			"Notes",
			["en" => "Brewing time in minutes",
			"ja" => "抽出時間(分)",
			"x-id" =>
			"S_Design_Experiment_Coffee_Data_Brewing_time_in_minutes_2_Not",
			"zh-CN" => "以分钟计的冲泡时间"]
		),
		Set Values( [4, 3, 3, 4, 4, 4, 3, 3, 4, 3, 4, 3] ),
		Set Display Width( 0 )
	),
	New Column(
		["en" => "Charge",
		"ja" => "豆の量",
		"x-id" => "S_Design_Experiment_Coffee_Data_Charge_2_Col",
		"zh-CN" => "咖啡豆的量"],
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Coding", {1.6000000000000001, 2.3999999999999999} ),
		Set Property( "Design Role", DesignRole( Continuous ) ),
		Set Property( "Factor Changes", Easy ),
		Set Property(
			"Notes",
			["en" => "Grams of coffee beans per ounce of water",
			"ja" => "湯1オンスあたりのコーヒー豆の量(グラム)",
			"x-id" =>
			"S_Design_Experiment_Coffee_Data_Grams_of_coffee_beans_per_ounce_2_Not",
			"zh-CN" => "每盎司水冲泡的咖啡豆克数"]
		),
		Set Values(
			[2.3999999999999999, 1.6000000000000001, 1.6000000000000001,
			2.3999999999999999, 1.6000000000000001, 2.3999999999999999,
			1.6000000000000001, 2.3999999999999999, 1.6000000000000001,
			2.3999999999999999, 1.6000000000000001, 2.3999999999999999]
		),
		Set Display Width( 0 )
	),
	New Column(
		["en" => "Station",
		"ja" => "場所",
		"x-id" => "S_Design_Experiment_Coffee_Data_Station_2_Col",
		"zh-CN" => "测量地点"],
		Character( 1 ),
		"Nominal",
		Set Property( "RunsPerBlock", 4 ),
		Set Property( "Design Role", DesignRole( Blocking ) ),
		Set Property( "Factor Changes", Easy ),
		Set Property(
			"Notes",
			["en" => "Table at which the coffee was brewed",
			"ja" => "コーヒーを抽出したところのテーブル",
			"x-id" =>
			"S_Design_Experiment_Coffee_Data_Table_and_setup_apparatus_at_whi_2_Not",
			"zh-CN" => "冲泡咖啡的工作台"]
		),
		Set Property( "Value Order", {Custom Order( {"1", "2", "3"} )} ),
		Set Values( {"1", "1", "1", "1", "2", "2", "2", "2", "3", "3", "3", "3"} ),
		Set Display Width( 0 )
	),
	New Column(
		["en" => "Strength",
		"ja" => "濃度",
		"x-id" => "S_Design_Experiment_Coffee_Data_Strength_2_Col",
		"zh-CN" => "浓度"],
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 2 ),
		Set Property(
			"Response Limits",
			{Goal( Match Target ), Lower( 1.2 ), Upper( 1.3999999999999999 ),
			Importance( . ), Show Limits( 0 )}
		),
		Set Property(
			"Notes",
			["en" =>
			"Amount of dissolved solids in the coffee as measured by a refractometer",
			"ja" => "コーヒーの中に溶かした固体の量を屈折計で測定したもの",
			"x-id" =>
			"S_Design_Experiment_Coffee_Data_Amount_of_dissolved_solids_in_th_2_Not",
			"zh-CN" => "使用折射计测量的咖啡溶解固体量"]
		),
		Set Values(
			[1.78, 1.25, 1.1000000000000001, 1.6299999999999999, 1.26,
			1.6299999999999999, 1.22, 1.51, 1.0700000000000001, 1.26,
			1.1299999999999999, 1.25]
		),
		Set Display Width( 0 )
	),
	New Column( "Pred Formula Strength",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Property( "Notes", "Prediction Formula" ),
		Formula(
			1.34083333333333 + Match( :Grind,
				"Coarse", -0.010833333333333301,
				"Medium", 0.010833333333333301,
				.
			) + -0.012500000000000001 * ((:Temperature - 200) / 5)
			+0.075833333333333294 * ((:Time - 3.5) / 0.5) + 0.16916666666666699 * ((
			:Charge - 2) / 0.40000000000000002)
			+Match( :Station,
				"1", 0.099166666666666695,
				"2", 0.064166666666666594,
				"3", -0.163333333333333,
				0
			)
		),
		Set Property(
			"Response Limits",
			{Lower( 1.2, 0.0183 ), Middle( 1.2999999999999998, 1 ),
			Upper( 1.3999999999999999, 0.0183 ), Goal( "Match Target" ),
			Importance( 1 )}
		),
		Set Property(
			"Predicting",
			{:Strength, Creator( "Fit Least Squares" ), ID( 1912791533 ),
			Std Dev( 0.078070480977127488 )}
		),
		Set Selected
	)
);
dt = Current Data Table();

//Create Custom Profiler
cust = Custom Profiler(
	Y( :Pred Formula Strength ),
	Custom Profiler(
		1,
		Term Value(
			:Grind( "Medium", Lock( 0 ), Show( 1 ) ), :Temperature( 180, Min( 180 ), Lock( 0 ), Show( 1 ) ), :Time( 3.5, Lock( 0 ), Show( 1 ) ),
			:Charge( 2, Lock( 0 ), Show( 1 ) ), :Station( "1", Lock( 0 ), Show( 1 ) )
		),
		Objective Formula( :Pred Formula Strength )
	)
);
//Get value of lists for X factors
reportc = cust << Report;
	//Extract the value typed in the box
bob = reportc["Custom Profiler", Number Col Edit Box( "Current X" )];
value_list = bob << Get;
		//Extract the value from the string
value = value_list[1];
//Test value list retrieval
Write( value );

//Create separate window that can change the button value
Buttonwind = New Window( "Hello", Outline Box( "Press the button", Button Box( "Press me", Write( "185" ) ) ) ); //insert command to change second value in list for 'Temperature' to 185
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to edit Number Col Edit Boxes in the Custom Profiler

If you check Number Col Edit Box from scripting index you can find example. Set Values is one option

jthi_0-1729508356302.png

 

Buttonwind = New Window("Hello",
	Outline Box("Press the button", 
		Button Box("Press me",
			new_value_list = value_list;
			new_value_list[2] = 185;
			bob << Set Values(Matrix(new_value_list));
		)
	)
);
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to edit Number Col Edit Boxes in the Custom Profiler

If you check Number Col Edit Box from scripting index you can find example. Set Values is one option

jthi_0-1729508356302.png

 

Buttonwind = New Window("Hello",
	Outline Box("Press the button", 
		Button Box("Press me",
			new_value_list = value_list;
			new_value_list[2] = 185;
			bob << Set Values(Matrix(new_value_list));
		)
	)
);
-Jarmo