Even though I would never use leading whitespace in column name (I would also avoid most of special characters), in this case I would say it should work, as it seems to be valid column name in JMP. I would say this is a bug with New Column.
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(1),
New Column("A", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
New Column(" A", Numeric, "Continuous", Format("Best", 12), Set Values([2]))
);
wait(1);
Column(dt, 2) << Set Name(" A");
wait(1);
dt << New Column(" A");
Only "quick" workaround that comes to my mind is to add << Set Name to New Table script, but I'm not sure if this would trigger before groupings are done
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(1),
New Column("A", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
New Column(" A", Numeric, "Continuous", Format("Best", 12), Set Values([2]), << Set Name(" A"))
);
so you would first have to get the script to clipboard and then get it as a text and modify that before running it.
This is very quick example which works with this one example:
Names Default To Here(1);
str = JSL Quote(dt = New Table("Untitled",
Add Rows(1),
New Column("A", Numeric, "Continuous", Format("Best", 12), Set Values([1])),
New Column(" A", Numeric, "Continuous", Format("Best", 12), Set Values([2]))
));
new_lines = {};
For Each({line}, Words(str, "\!N"),
If(Starts With(Trim Whitespace(line), "New Column("),
// get column name
col_name = Regex(Trim Whitespace(line), "^New Column\(\!"(.+?)\!",\s", "\1");
// add set name
last_idx = Contains(line, ")", -1);
new_line = Left(line, last_idx - 1) || ", << Set Name(\!"" || col_name ||"\!")),";
Insert Into(new_lines, new_line);
,
Insert Into(new_lines, line);
);
);
old_dt = Eval(Parse(str));
new_dt = Eval(Parse(Concat Items(new_lines, "\!N")));
-Jarmo