@txnelson :
Thank you . While I am familiar with this approach - what surprised me was the way @ms was solving the same problem .
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column("Conditional sum", Formula(Col Sum(:age, Selected()))); // This Works
dt << select Where(:age == 12);
n = Col Sum(:age,Selected()); // This yields an error
While I understand that line 4 can be easily replaced with your solution i.e. and that is my goto solution,
n = Sum(:age[dt << Get Selected Rows]);
I dont understand why this line of code is resulting in an error in my case .
n = Col Sum(:age,Selected());
The documentation doesn't show that this feature exists ( atleast in JPM 12) - so was really excited by this new trick but it seemed to work in the case @ms Solved the question earlier. Can either of you explain why the exact same code works in a column formula but throws an error outside ?
Uday
Best
Uday