cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to use JMP Pro to analyze and predict using entire data set rather than selected points in a curve. Register for Nov. 6 Mastering JMP.

Discussions

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

Return "True" or "False" if multiple columns contain string

Hi,

 

I would like to return "False" if any column data contains "hello" else return a "True"

 

kuanaunwei_0-1648740670624.pngkuanaunwei_0-1648740670624.png

 

I am only able to process 1 column with if, any ideas?

10 REPLIES 10
jthi
Super User

Re: Return "True" or "False" if multiple columns contain string

I assume this is what you are looking for

jthi_0-1742976340359.png

You have already been basically provided answer for this, pick "correct" "formula" (these do not evaluate dynamically) and add additional check for "hi"

 

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(3),
	New Column("Column 1", Character, "Nominal", Set Values({"hello", "bye", "bye"})),
	New Column("Column 2", Character, "Nominal", Set Values({"hello", "bye", "bye"})),
	New Column("Column 3", Character, "Nominal", Set Values({"hello", "hello", "bye"})),
	New Column("Column 4", Character, "Nominal", Set Values({"hello", "a hello a", "bye"})),
	New Column("Column 5", Character, "Nominal", Set Values({"hello", "bye", "bye"}), Set Display Width(75)),
	New Column("Column 6", Character, "Nominal", Set Values({"hello hello hi", "hi hi hi hi", "bye"}))
);

dt << new column("C", numeric, continuous, formula(
	If(Row() == 1,
		dt = Current Data Table();
		rangelow = 1;
		rangehigh = 6;
	);
	res = Filter Each({val}, dt[Row(), Index(rangelow, rangehigh)], Contains(val, "hello") | Contains(val, "hi"));
	N Items(res);
));

 

 

-Jarmo

Recommended Articles