cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

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