Subscribe Bookmark RSS Feed

including formula in a column using JSL

fr2007

Community Trekker

Joined:

Jul 3, 2012

i want to add a column that performs the following calculation:

if(Is Missing(Column1)=> 2

else=> column2)

how do i include in the column code using JSL.

i wrote a code like this:

dt<<new column("New Date",

continuous,

Format("m/d/y",12),

Formula(if(Is Missing(:Column1)), 2

else :Column2

));

but it is not working..can some one help..

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Check out the correct syntax for the If() function, e.g. by using the excellent Scripting Index (Help menu)  Why does your code not work? A comma is missing, else is not needed or even defined, and paranthesis appears to be misplaced. Check also that the the column names are Column1 and Column2 and not Column 1 and Column 2 (Default in a new table is with a space. JMP is picky about white-space in strings).

This may have a better chance to work:

dt<<new column("New Date",

continuous,

Format("m/d/y",12),

Formula(if(Is Missing(:Column 1), 2,

:Column 2

)));

1 REPLY
Solution

Check out the correct syntax for the If() function, e.g. by using the excellent Scripting Index (Help menu)  Why does your code not work? A comma is missing, else is not needed or even defined, and paranthesis appears to be misplaced. Check also that the the column names are Column1 and Column2 and not Column 1 and Column 2 (Default in a new table is with a space. JMP is picky about white-space in strings).

This may have a better chance to work:

dt<<new column("New Date",

continuous,

Format("m/d/y",12),

Formula(if(Is Missing(:Column 1), 2,

:Column 2

)));