The implementation of row-wise operations across an unknown number of columns in column formulas is not very straightforward (however magic is not required).
Below are some ideas taking advantage of local variables:
// Just an example table
n = 5;
nr = 10;however
dt = New Table("Screening summary", Add Rows(nr), Add Multiple Columns("X", n, character));
For(i = 1, i <= n, i++,
Column(dt, i) << Set Each Value({"screened", "unscreened"}[1 + (Random Integer(1, nr) > 1)])
);
// New column indicating if any column contains "screened"
dt << New Column("Screened",
Character,
Formula(
Local({i = 0, n = N Col(Current Data Table()) - 1},
If(Contains(Repeat({i++ ; Column(i)[]}, n), "screened"),
"screened"
)
)
)
);
// The same but with a For() loop; less neat code but probably more efficient than Repeat() for large n
// because no intermediate lists are built
dt << New Column("Screened 2",
Character,
Formula(
Local({i, n = N Col(Current Data Table()) - 2, s = ""},
For(i = 1, i <= n, i++,
If(Column(i)[] == "screened",
s = "screened";
Break();
)
);
s;
)
)
);
// Alternatively, return nr of "screened"
dt << New Column(" Nr of Screened",
Numeric,
Formula(Local({i = 0, n = N Col(Current Data Table()) - 3}, Sum(Repeat({i++ ; Column(i)[] == "screened"}, n)))));