- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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 );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Delete formula status without deleting values
I suggest using this dedicated message:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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();
));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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 );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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...