Here is an example
names default to here(1);
dt =
New Table( "Example",
Add Rows( 20 ),
New Column( "column 1",
Character,
Formula( "A" || Char( Random Integer( 1, 100 ) ) )
),
New Column( "column 2",
Character,
Formula( "A" || Char( Random Integer( 1, 100 ) ) )
)
);
colList = dt << get column names( string );
For Each( {col}, colList,
dt << New Column( col || " Letter",
character,
set each value( Substr( As Column( col ), 1, 1 ) )
);
dt << New Column( col || " Number",
set each value( Num( Substr( As Column( col ), 2 ) ) )
);
);
Or using a For() Loop
names default to here(1);
dt =
New Table( "Example",
Add Rows( 20 ),
New Column( "column 1",
Character,
Formula( "A" || Char( Random Integer( 1, 100 ) ) )
),
New Column( "column 2",
Character,
Formula( "A" || Char( Random Integer( 1, 100 ) ) )
)
);
colList = dt << get column names( string );
For( i=1,i<= NItems(colList), i++,
dt << New Column( colList[i] || " Letter",
character,
set each value( Substr( As Column( colList[i] ), 1, 1 ) )
);
dt << New Column( colList[i] || " Number",
set each value( Num( Substr( As Column( colList[i] ), 2 ) ) )
);
);
Jim