cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
hogi
Level XI

Expression Handling in JMP: Tipps and Trapdoors

There is a wonderful lecture by  in the Discovery Summit Series:

Using JSL to Develop Efficient, Robust Applications (EU 2018 415) 
Based on the content of Expression Handling Functions: Part I - Unraveling the Expr(), NameExpr(), Eval(), ... Conundrum 

@joseph_morgan explains the secrets and possibilities of Expression Handling in JSL - and the trapdoors associated with it.

 

further info can be found in the Scripting Guide: advanced-expressions-macros-and-lists 

Basics 
Protect an Expression from being evaluated, just store itx= Expr(2+1)
get the expression stored in my variable nameName Expr(my variable name)
force evaluationEval(myexpr)
  
Applications 
90% of all workaroundsEval(substitute(  ))
pre-evaluate an ExpressionEval(Eval Expr ( ... Exp(eval 1st) ...))
ultimate trick for column references (I learned it from @jthi)Name Expr(as column(column name))

 

Examples:

 

TopicLinksDetails
Column vs. As column vs. name

Why do these ways of referencing columns give different results?How to replace :column_name with variable in JMP JSL?Column() vs As Column() vs datable:column vs dt:As name("column") 

 

Column references in column formulas

Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute

Trying to create a column and fill it with a formula but I get an error.

Use expr() to replace variable column names in a formulaAdding Formula Columns based on Column Name ListCreating a formula column from a list ( JSL )Need help with expressions, column references, formulas and column renamingCreate new columns by loop formula calculation with specific column namesJSL to create formula column with variable column names Column name from string 

Script concatenate columns 

Using Expr() and Eval() with variables name inside a loopUse column variable in IF expression

JSL: Creating formula using a variable column name

Using variables to create formula columnscreating formula using existing column names 

use 

Name Expr(As Column(colname))

with Eval(Substitute())

or

As Column (Expr(colname))
with Eval(Eval Expr()).

 

Column references in platform calls and messages

JSL help proper referencing of a columnRun a Platform without Knowing the Number or Names of Columns

Distribution using column list 

JSL: help properly referencing a data table column for Distribution platform 

use

Name Expr(As Column(colname))

with Eval(substitute())

... or just eval() or  evallist()in the column argument 

use a column reference in a function call

Column reference in custom functionCustom Function - how to reference the column

- wrap the column with
 Name Expr()

- use a list

construct an expression 

Can you construct this without writing expression as a string?Run a Platform without Knowing the Number or Names of ColumnsUsing list of columns in formulas

How to script an aggregate column from a variable list of column references 

- start with an empty draft and fill it via insert into(draft, arguments)

- use substitute

- create a list, and substitute list with another JSL symbol

further workarounds via Expression handling

Exclude rows in Col Quantile Calculation

prevent inappropriate caching in Col Quantile by using an expression.

From version to version, less expression handling is needed to make things worklink? 
1 REPLY 1
SDF1
Super User

Re: Expression Handling in JMP: Tipps and Trapdoors

Hi @hogi ,

 

  Thanks for consolidating this information and bringing a lot of this information together. The talk sounds really informative.

 

  I do like how you can do things several different ways in JMP and in JSL, but sometimes there are too many different ways that are very specific to the case at hand, and this can become somewhat cumbersome when trying to make code that is generic and able to handle many different scenarios.

 

Thanks!,

DS