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

- JMP User Community
- :
- Discussions
- :
- Re: How to "Suppress Eval" ?

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

Highlighted

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

Oct 5, 2016 2:12 PM
(10014 views)

Hello

trying to put a formula that simply counts (increments) based on the occurences of the same asset_num in time.

I like this formula to be calculated one time and then either suppress eval OR even delete formulae.

Any help will be appreciated.

below, I tried suppress eval(false) to let the formula calculate and then suppress eval(true) to suppress it...

it did not work.

thanks

::MyCntDwn2 = Function( {dt}, {Default Local},

col=New Column("Countdown",Numeric,"Continuous",Format( "Best", 12 ));

col<<Set Formula(

If( Row() > 1,

If( :asset_num == Lag( :asset_num, 1 ),

Lag( :Countdown, 1 ) + 1,

1

),

1

)

);

col << suppress eval(false);

col << suppress eval(true);

);

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

I guess the <<suppress eval() messages are executed so fast that the formula never has time to evaluate.

Use <<Eval Formula to force column to evaluate before suppressing it:

...

col << **eval formula**;

col << **suppress eval****(**true**)**;

...

But, if you don't really need a formula you can just calculate the values once:

::MyCntDwn2 = Function**({**dt**}**,

col = dt << **New Column****(**"Countdown", Numeric, "Continuous", Format**(**"Best", **12****))**;

For Each Row**(**

col**[]** = If**(**Row**()** > **1**,

If**(**:asset_num**[]** == Lag**(**:asset_num**[]**, **1****)**,

Lag**(**col**[]**, **1****)** + **1**,

**1**

**)**,

**1**

**)**

**)**;

**)**;

3 REPLIES 3

Highlighted

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

I guess the <<suppress eval() messages are executed so fast that the formula never has time to evaluate.

Use <<Eval Formula to force column to evaluate before suppressing it:

...

col << **eval formula**;

col << **suppress eval****(**true**)**;

...

But, if you don't really need a formula you can just calculate the values once:

::MyCntDwn2 = Function**({**dt**}**,

col = dt << **New Column****(**"Countdown", Numeric, "Continuous", Format**(**"Best", **12****))**;

For Each Row**(**

col**[]** = If**(**Row**()** > **1**,

If**(**:asset_num**[]** == Lag**(**:asset_num**[]**, **1****)**,

Lag**(**col**[]**, **1****)** + **1**,

**1**

**)**,

**1**

**)**

**)**;

**)**;

Highlighted
##

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

Re: How to "Suppress Eval" ?

Hi Altug,

In cases like these I usually just delete the formula after:

dt = Current Data Table();

dt << new column("Countdown",

formula((Row() - Col Minimum( Row(), :asset_num )) + 1)

);

column(dt, "Countdown") << Delete Formula;

Highlighted
##

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

Re: How to "Suppress Eval" ?

Both of your formulaes worked. Thanks so much ...

Appreciate the help.

Article Labels

There are no labels assigned to this post.