I am looking for help switching between column names (e.g. :Height) and strings ("Height").
In this script, I am building a string to use in the table join command. I am using the bylizt earlier in a script for a table summary so I like the bylizt as columns. The dialog box returns a list of columns; in this example, there are two columns, but there could be any number of columns.
bylizt = {:Rec Type, :Step};
I want to take this result and build a string to insert into the join command.
MatchColString = " :Rec Type = :Rec Type, :Step = :Step";
Is there an easy way to build this string?
Ultimately, this string goes here:
Eval(Parse(Eval Insert("
wrefdt = cdt << Join(
With( Data Table( subsumdt ) ),
Merge Same Name Columns,
By Matching Columns(^MatchColString^ ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 1 ),
Preserve main table order( 1 ),
Output Table( newname )
);
")));
I agree that it would be easier to get the column names as strings, but I am using a column dialog box, so you get what you get.
It would be easier to get column names as strings, but this will work:
bylizt = {:Rec Type, :Step};
for (i = 1, i <= nitems(bylizt), i++,
one_col = ":" || char(bylizt[i]);
if (i == 1,
matchcolstring = one_col || " = " || one_col;
,
matchcolstring = matchcolstring || ", " || one_col || " = " || one_col;
);
);
show(matchcolstring);