Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- How to fix a variable in a column formula

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 9, 2015 9:24 AM
(3837 views)

Hi,

thanks to a script, I want to create a column with a formula which contain a variable as follow:

dt=current data table** ()**;

variable1=**10**;

dt<<new column** (**"exemple", numeric, continu, formula

I would like this result in the column formula:

:othercolumn*10

But, I have :othercolumn*variable1.

Any idea of how to fixe the variable?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Formula() does not evaluate its argument expression (which makes sense); the expression is just passed on to the data table and evaluated there. Thus the variable must be evaluated before creating the column. Below is one way to do it (see other approaches in earlier as I'm sure this issue has been up before).

Eval**(**Eval Expr**(**dt << **New Column****(**"exemple", numeric, formula**(**:othercolumn * Expr**(**variable1**)))))**;

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Formula() does not evaluate its argument expression (which makes sense); the expression is just passed on to the data table and evaluated there. Thus the variable must be evaluated before creating the column. Below is one way to do it (see other approaches in earlier as I'm sure this issue has been up before).

Eval**(**Eval Expr**(**dt << **New Column****(**"exemple", numeric, formula**(**:othercolumn * Expr**(**variable1**)))))**;