cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
vsr
vsr
Level I

Delete formula status without deleting values

Hello,

I have a for loop for calling formulas from a file.

The loop works fine but when I try removing the formula and maintaining the created values using

<<delete formula

or

<<delete property(formula);

 

the formula is removed but the values are all gone as well.

This happens for both JMP 11 and 14.

can you please help?

 

loop:

 

formula_table = Open( formula table adress, Worksheets( "Formulas" ), Invisible );
//open data table

 For( i = 1, i <= N Rows( formula_table ), i += 1,

 col = data << New Column( formula_table:Column Name[i]/*, Eval( formula_table:Type[i] )*/ );
  If(
   formula_table:Type[i] == "Character", col << Data Type( Character ),
   formula_table:Type[i] == "Numeric", col << Data Type( Numeric )
  );
  a = Concat( formula_table:Formula[i] );
  a = Parse( a );
  col << Formula( a ); // sets formula
  col << delete formula;//doesn't work as described above
 );
 Close( formula_table, NoSave );

Thanks


 

 

 

8 REPLIES 8
txnelson
Super User

Re: Delete formula status without deleting values

Here is a simple example showing that the

      col << delete property(formula);

works.  

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

col = dt << New Column( "zippy", formula( Row() ) );

col << delete property( formula );
Jim

Re: Delete formula status without deleting values

I've had the same issue this morning and had to place a wait before the delete formula line. 

 

wait(0);
:CoatingTime << Delete property(Formula);


Before placing the 'wait(0)', my column values were deleted as well. 

Re: Delete formula status without deleting values

I suggest using this dedicated message:

 

delete.PNG

vince_faller
Super User (Alumni)

Re: Delete formula status without deleting values

I prefer to just <<Set Each Value since it seems like what you're really trying to do.  But you could also just dt << Run Formulas() to make sure it actually finishes running before deleting the formula. 

 

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
f = expr(:height/:weight);
Eval(EvalExpr( // doing this so it doesn't just keep the "f" var there
	dt << New Column("SetEach", 
		<<Set Each Value(Expr(nameexpr(f)))
	);


	col = dt << New Column("Form", 
		<<Formula(Expr(nameexpr(f)))
	);
	//dt << Run Formulas(); // this will make sure it runs before you delete it.  
	col << Delete Formula();
));
Vince Faller - Predictum
Oren_Barilan
Level I

Re: Delete formula status without deleting values

On the same note, is there a command for deleting formulas from multiple columns?

I would like to delete existing formulas in a table without deleting the values in columns. 

 

I was trying to remove formulas by using the standardize attributes and remove formula, but nothing happened.

 

Thank you.

mmarchandTSI
Level V

Re: Delete formula status without deleting values

I don't think there is, but it doesn't take much to delete the formula from a column list.

 

For Each( {v, i}, collist, v << Delete Formula );
Jeff_Perkinson
Community Manager Community Manager

Re: Delete formula status without deleting values

You can use Standardize Attributes for this.

 

Use the bottom part of the dialog to Delete the Formula property.

 

2024-02-19_09-32-11.049.png

 Admittedly it is a bit confusing because after adding "Formula" you see a Remove button appear. That Remove is to remove the Formula entry from the Delete Properties section not to Remove the formula from columns. To remove the formula from the columns you have to click the OK or Apply button for the dialog.

2024-02-19_09-32-23.917.png

-Jeff
hogi
Level XI

Re: Delete formula status without deleting values


@vince_faller wrote:

I prefer to just <<Set Each Value ...

Yes
I hope that Set Each Values with this "unsupported" functionality will also be available in future versions of Jmp ...

TS - 00049239:
Make using formula expressions in Set Each Value and using expressions as first argument in Col stat...