Subscribe Bookmark RSS Feed

long formula for a column in another file

huangshuojch

Community Trekker

Joined:

Nov 30, 2014

Hi,

Is there any way to put a long formula for a column to another JSL file. My table has a column which has an about 1000 lines formula. I want to put this formula to another JSL file so that the main file will look like cleaner.

Thanks

3 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

The way to add a column formula to a table using JSL is like this:

dt = open("$sample_data\Big Class.jmp");

dt << New Column( "BMI", Numeric, Continuous, Format( "Fixed Dec", 12, 2 ),

// Your formula goes here:

        Formula( ((:weight * 703) / :height) / :height )

// end formula

     );

pmroz

Super User

Joined:

Jun 23, 2011

I'm re-reading your post.  Perhaps you simply need the INCLUDE statement?  Just put the statements to add the new column in another JSL file (called new_column.jsl for example).  Then in your main program you would have this:

include("c:\mydata\new_column.jsl");

Craige_Hales

Staff

Joined:

Mar 21, 2013

If there are multiple formula columns and some of the formula columns use other formula columns, JMP needs to see the relationships to determine which columns must evaluate first.  If you move the formula out of the column, JMP will not get the evaluation order correct for columns that are dependent on other columns.

If you create a user defined function, AND you make sure it is defined ahead of time, you can call it from the column formula.  This seems clumsy, maybe a better idea will pop up.

8771_formula.PNG

Craige