Here is other solution using matrices (could be turned into formula also):
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(8),
Compress File When Saved(1),
New Column("Feature #", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4, 5, 6, 7, 8])),
New Column("FVT", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 3, 3, 1, 1, 1, 1])),
New Column("EVT", Numeric, "Continuous", Format("Best", 12), Set Values([., ., 3, 3, ., ., ., .])),
New Column("CVT", Numeric, "Continuous", Format("Best", 12), Set Values([2, 2, 3, 3, 2, 2, 2, 2])),
New Column("MSV", Numeric, "Continuous", Format("Best", 12), Set Values([3, 3, 3, 3, 2, 2, 2, 2])),
New Column("GQ", Numeric, "Continuous", Format("Best", 12), Set Values([., ., 3, 3, ., ., ., .])),
New Column("Cert", Numeric, "Continuous", Format("Best", 12), Set Values([3, 3, 3, 3, 3, 3, 3, 3])),
New Column("HW", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 3, 2, 3, 3, 3, 3])),
New Column("PE", Numeric, "Continuous", Format("Best", 12), Set Values([2, 2, 3, 3, 2, 2, 2, 2])),
New Column("MFG Test", Numeric, "Continuous", Format("Best", 12), Set Values([2, 2, 3, 3, 2, 2, 2, 2])),
New Column("PDE", Numeric, "Continuous", Format("Best", 12), Set Values([., ., 3, 3, ., ., ., .])),
New Column("TCM / FAE?", Numeric, "Continuous", Format("Best", 12), Set Values([., ., 3, 3, ., ., ., .]))
);
col_names = Remove(dt << Get Column Names("String"), 1); //drop feature
all_ones = dt[0, 2::N Cols(dt)] == 1; //print this
dt << New Column("Summary", Character, << Set Each Value(
teams = Loc(all_ones[Row(), 0]);
If(N Items(teams) > 0,
Concat Items(col_names[teams], " ")
, "Gap"
)
));
Some explanation:
col_names = Remove(dt << Get Column Names("String"), 1);
get team names
all_ones = dt[0, 2::N Cols(dt)] == 1;
Get values in datatable to matrix. If cell value is 1 set it as 1, if it is missing leave as missing and other values will become 0
teams = Loc(all_ones[Row(), 0])
For current Row() get indices for columns which have 1
If(N Items(teams) > 0, Concat Items(col_names[teams], " ") , "Gap")
Use col_teams[teams] to get list of teams which have 1, if teams count is 0 set as "Gap"
-Jarmo