cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

User Defined Functions with Expression arguments

In JSL there are many functions which allow Expressions as arguments, like

 

dt << New Column( "X", Formula( row() ) );

 

where the supplementary argument Formula( row() ) can be at any position (N>1) within (...) because it can be identified via the keyword 

Formula().

 

Can user-defined functions have similar supplementary arguments?

 

 

2 REPLIES 2
Craige_Hales
Super User

Re: User Defined Functions with Expression arguments

No. The user defined function always evaluates the arguments that were passed before putting the values into its local parameters.

 

You could use expr(), but a list is a better choice: myfunc( "X", { formula( row() ) } ). I used that somewhere recently, and it worked well; variables inside the list still need to be evaluated, and myfunc finds them in the proper calling context. (Assuming no collisions between the caller names and myfunc names...) I think I used a single list and took advantage of nitems() as well.

Craige
hogi
Level XIII

Re: User Defined Functions with Expression arguments

Thanks @Craige_Hales , the workaround with the list - brilliant :)

 

Hm, worth to write a post for the wish list?

Ah, there is one:
Keyword arguments for functions 

Recommended Articles