cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
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