Assume I have a table with headers Greek and AlsoGreek as follows:
Greek AlsoGreek
Alpha Phi
Beta Omega
Gamma Zeta
The following script will give me a column called "concat" which will combine the 2 columns (I added tabs between the concat symbols to make it more readable).
dt = Current Data Table();
colnames = dt<<get column names;
colstring=":Name(\!"" || char(colnames[1]) || "\!")";
for(i=2,i<=nitems(colnames),i++,
colstring=colstring || "||" || ":Name(\!"" || char(colnames) || "\!")"
);
parsecolstring=parse(colstring);
dt<<new column("concat",formula(parsecolstring));
Now what's weird is if I put the table header AlsoGreek in quotes (as "AlsoGreek"), the code does not work. Here's the output of the error log (I added show after all the variables in the above code so that I could see what was happening
colnames = {Greek, Name("\!"AlsoGreek\!"")};
Char(colnames[1]) = "Greek";
colstring = ":Name(\!"Greek\!")";
colstring = ":Name(\!"Greek\!")||:Name(\!"\!"AlsoGreek\!"\!")";
Expected ")", but found "AlsoGreek".
Line 1 Column 25: :Name("Greek")||:Name(""►AlsoGreek"")
Is there a solution for this? If not, is there a way to extract the quotation marks from the column name? I tried using substitute to remove the \!", but JMP doesn't recognize this as a string...
Any help would be greatly appreciated! I have >100 columns with quotes in the column name...