// Create data table
dt = New Table( "Floor Example",
Add Rows( 4 ),
New Column( "Unit ID", Character, Nominal, Set Values( {"A", "B", "C", "D"} ) ),
New Column( "Data1", Numeric, Continuous, Format( "Best", 12 ),
Set Values( [1.1, 1.2, 1.3, 1.1] ) ),
New Column( "Data2", Numeric, Continuous, Format( "Best", 12 ),
Set Values( [1.2, 1.2, 1.2, 1.2] ) ),
New Column( "Data3", Numeric, Continuous, Format( "Best", 12 ),
Set Values( [1.1, 1, 1.4, 1.1] ) ),
);
// Get the list of column names
col_list = dt << get column names(string);
// Loop over column names, searching for data columns
for (i = 1, i <= nitems(col_list), i++,
// If it's a Data column then add the floor formula
if (contains(col_list[i], "Data"),
data_col = ":" || col_list[i];
floor_col = col_list[i] || "_Floor";
// Build new column string dynamically and then execute it.
str = evalinsert(
"\[dt << New Column( "^floor_col^", Numeric, Continuous, Format( "Best", 12 ),
Formula( Floor( ^data_col^))
);]\");
eval(parse(str));
);
);