The best way to do this would be to recursively tokenise the formula expression into a tree, then scan the leaf nodes for column references. This is perfectly possible in JSL using the expression manipulation primitives provided (look in the Section 'Lists and Expressions' within the JMP Scripting Guide, paying attention to the 'Head()', 'NArg()' and 'Arg()' functions). But you might need to dig out a computer science book to code up this method.

Alternatively, the code below offers a kludgy way to get JMP to do the work for you (using the profiler):

NamesDefaultToHere**(****1****)**;

dt = New Table**(** "Get Columns in Formula",

Add Rows**(** **20** **)**,

New Column**(** "H",

Numeric,

"Continuous",

Format**(** "Best", **12** **)**,

Formula**(** Random Uniform**()** **)**

**)**,

New Column**(** "W",

Numeric,

"Continuous",

Format**(** "Best", **12** **)**,

Formula**(** Random Uniform**()** **)**

**)**,

New Column**(** "D",

Numeric,

"Continuous",

Format**(** "Best", **12** **)**,

Formula**(** Random Uniform**()** **)**

**)**,

New Column**(** "V",

Numeric,

"Continuous",

Format**(** "Best", **12** **)**,

Formula**(** **(**:W * :H * :D**)** / **10** **)**

**)**

**)**;

// Launch the Profiler invisibly

p = dt << **Profiler****(**Y**(** :V **)**, Expand, Invisible**)**;

// Get the grid table

p << **OutputGridTable**;

// Get the columns in the grid table into a list

cols = DataTable**(**NTable**())** << **getColumnNames****(**"String"**)**;

// Clean up

p << **CloseWindow**;

Close**(**DataTable**(**NTable**())**, NoSave**)**;