cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

Add column based on a user input.

I made a script which gives a pop box to enter suspected wafer list. Than it will add a column to the table with using If loop. This script is working fine when Wafer data type is Character but it doesn't work with Numerical type data type. How can I fix this?

dt = Current Data Table(); // Get the current data table
nw = New Window("Enter Shop order",
	<<Modal,
	<<Return Result,
	V List Box(
		Text Box(" "),
		variablebox = Text Edit Box("", <<Set N Lines(30), <<Set Width(150)),
		Spacer Box(Size(0, 10)),
		Button Box("OK"),
		Button Box("Cancel")
	)
);

unique = Collapse Whitespace(nw["variablebox"]);
sql_in = Associative Array(Words(unique, ", ")) << get keys;
myValueList = Concat Items(sql_in, ", ");



// Define a list of values to check against
//myValueList = {"1", "2"};

// Create a new column with a formula using the If statement
dt << New Column("Suspected",
	Formula(
		If(Contains(myValueList, :Name("Wafer")), 
			"Yes", 
			"No" 
		)
	)
);

Untitled.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Add column based on a user input.

Most likely easiest option is to wrap your :Wafer column in the formula with Char()

dt << New Column("Suspected", Formula(If(Contains(myValueList, Char(:Wafer)), "Yes", "No")));
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Add column based on a user input.

Most likely easiest option is to wrap your :Wafer column in the formula with Char()

dt << New Column("Suspected", Formula(If(Contains(myValueList, Char(:Wafer)), "Yes", "No")));
-Jarmo

Recommended Articles