cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

How to "Suppress Eval" ?

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
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to "Suppress Eval" ?

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

        )

    );

);

View solution in original post

3 REPLIES 3
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to "Suppress Eval" ?

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

        )

    );

);

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;

altug_bayram
Level V

Re: How to "Suppress Eval" ?

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

Appreciate the help.

Recommended Articles