Choose Language Hide Translation Bar
Highlighted
Community Trekker

## JSL: What to use for new columns, Formula or Set Each Value? Pros and Cons?

Hi All,

Can anyone highlight what are the differences between using "Formula" and "Set Each Value"? What are the pros and cons?

5 REPLIES 5
Community Trekker

## Re: JSL: What to use for new columns, Formula or Set Each Value? Pros and Cons?

@ram,
If you use the test script I put together below, you will be able to realize starting at a = 6, that set each value is more efficient .

``````a = 7; // Varied from 2 to 7

dt = New Table();

dt << Begin Data Update;

dt << Add Rows(10^a);

t1 = Tick Seconds();

dt << New Column("Test",Numeric,Continuous,Formula(5));

t2 = Tick Seconds();

dt << End Data Update;

Print(t2-t1);

t3 = Tick Seconds();

dt << New Column("Test",Numeric,Continuous,<< Set Each Value(a));

t4 = Tick Seconds();

Print(t4-t3);

``````

However, it is important to note that Set Each Value can only achieve one objective unlike Formula which is much more versatile. So I don't know the exact objective of performing this comparison, but this is one way to look at it

Best
Uday
Community Trekker

## Re: JSL: What to use for new columns, Formula or Set Each Value? Pros and Cons?

I was basically looking for functionality comparison between set each value vs formula function

Super User

## Re: JSL: What to use for new columns, Formula or Set Each Value? Pros and Cons?

Set Each Value places the value specified into each cell for the column it is pointed at.

The Formula element is a dynamic element, that allows for the specifying of a script of any complexity desired.  Additionally, a formula will be rerun anytime that components within the provided script(column values) are changed.

Jim
Community Trekker

## Re: JSL: What to use for new columns, Formula or Set Each Value? Pros and Cons?

but if you delete formula property, then based on your statement both should be same. but i guess there are more intrinsic differences.

Staff

## Re: JSL: What to use for new columns, Formula or Set Each Value? Pros and Cons?

I concur with Jim.

As an interactive JMP user, my only way to compute values when making a new column is to use a formula. As a scripter, I have a choice between using a formula or using myriad other means of populating the new column. I never use a formula in a script unless the values must update due to dependencies that might change after the script has run.

The decision is as simple as that IMO. But I would never tell someone else to follow my way.

Learn it once, use it forever!