cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-579015%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%A6%82%E4%BD%95%E7%A2%BA%E5%AE%9A%E4%B8%80%E5%88%97%E6%9C%89%E5%85%AC%E5%BC%8F%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-579015%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%88%91%E6%83%B3%E7%94%A8%E8%85%B3%E6%9C%AC%E5%BE%9E%E6%89%80%E6%9C%89%E5%88%97%E4%B8%AD%E5%88%AA%E9%99%A4%E6%89%80%E6%9C%89%E5%85%AC%E5%BC%8F%E3%80%82%20%E6%88%91%E5%AF%AB%E4%BA%86%E4%B8%80%E5%80%8Bforloop%EF%BC%8C%E4%BD%86%E6%98%AF%E9%9C%80%E8%A6%81%E7%A2%BA%E5%AE%9A%E4%B8%80%E5%88%97%E6%98%AF%E5%90%A6%E6%9C%89%E5%85%AC%E5%BC%8F%E3%80%82%20%E5%A6%82%E4%BD%95%E7%94%A8%E8%85%B3%E6%9C%AC%E5%81%9A%E5%88%B0%E9%80%99%E4%B8%80%E9%BB%9E%EF%BC%9F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-579015%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E6%95%B8%E6%93%9A%E8%A1%A8%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E8%85%B3%E6%9C%AC%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E8%A6%96%E7%AA%97%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-579023%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20%E5%A6%82%E4%BD%95%E5%88%A4%E6%96%B7%E4%B8%80%E5%88%97%E6%9C%89%E5%85%AC%E5%BC%8F%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-579023%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E4%B8%80%E7%A8%AE%E9%81%B8%E6%93%87%E6%98%AF%E4%BD%BF%E7%94%A8%20%26lt%3B%3CGET%20formula%3D%22%22%20with%3D%22%22%20is%3D%22%22%20empty%3D%22%22%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0Adt%20%3D%20Open(%22%24SAMPLE_DATA%2FBig%20Class.jmp%22)%3B%0Acol1%20%3D%20dt%20%26lt%3B%26lt%3B%20New%20Column(%22Ratio%22%2C%20Numeric%2C%20Continuous)%3B%0Acol1%20%26lt%3B%26lt%3B%20Formula(%3Aheight%20%2F%20%3Aweight)%3B%0Await(1)%3B%0A%0AFor%20Each(%7Bcol_name%7D%2C%20dt%20%26lt%3B%26lt%3B%20Get%20Column%20Names(%22String%22)%2C%0A%20col%20%3D%20Column(dt%2C%20col_name)%3B%0A%20If(!Is%20Empty(col%20%26lt%3B%26lt%3B%20get%20formula)%2C%0A%20%20Column(dt%2C%20col_name)%20%26lt%3B%26lt%3B%20Delete%20Formula%0A%20)%3B%0A)%3B%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FGET%3E%3C%2FP%3E%3CP%3EScripting%20Index%20%E6%9C%89%E5%BE%88%E5%A4%9A%E8%B3%87%E6%96%99%EF%BC%8C%E4%BD%A0%E5%8F%AF%E4%BB%A5%E7%9B%B4%E6%8E%A5%E5%BE%9E%20JMP%20%E7%9A%84%E8%8F%9C%E5%96%AE%20Help%20%2F%20Scripting%20Index%20%E4%B8%AD%E6%89%BE%E5%88%B0%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jthi_0-1670526823473.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1670526823473.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1670526823473.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F48061i42419665F6F600E8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jthi_0-1670526823473.png%22%20alt%3D%22jthi_0-1670526823473.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E5%A6%82%E6%9E%9C%E6%82%A8%E8%87%AA%E5%B7%B1%E6%B7%BB%E5%8A%A0%E9%80%99%E4%BA%9B%E5%85%AC%E5%BC%8F%E4%B8%A6%E4%B8%94%E4%B8%A6%E4%B8%8D%E7%9C%9F%E6%AD%A3%E9%9C%80%E8%A6%81%E5%AE%83%E5%80%91%E7%94%A8%E6%96%BC%E5%85%AC%E5%BC%8F%E4%BD%BF%E7%94%A8%EF%BC%8C%E5%89%87%E5%8F%AF%E4%BB%A5%E9%80%9A%E9%81%8E%E4%BD%BF%E7%94%A8%20%26lt%3B%26lt%3B%20Set%20Each%20Value()%20%E9%81%BF%E5%85%8D%E5%B0%87%E5%AE%83%E5%80%91%E5%85%A8%E9%83%A8%E6%B7%BB%E5%8A%A0%E5%9C%A8%E4%B8%80%E8%B5%B7%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar

How to determine a column has formula?

I would like to remove all formulas from all columns with script. I wrote a forloop but whether a column has formula needs to be determined. How to do that with scripts?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to determine a column has formula?

One option is to use <<Get Formula with Is Empty()

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
col1 = dt << New Column("Ratio", Numeric, Continuous);
col1 << Formula(:height / :weight);
wait(1);

For Each({col_name}, dt << Get Column Names("String"),
	col = Column(dt, col_name);
	If(!Is Empty(col << get formula),
		Column(dt, col_name) << Delete Formula
	);
);

Scripting Index has a lot of information and you can find it directly from JMP's menu Help / Scripting Index

jthi_0-1670526823473.png

If you add those formulas yourself and don't really need them for formula usage, you can avoid adding them all together by using << Set Each Value()

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How to determine a column has formula?

One option is to use <<Get Formula with Is Empty()

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
col1 = dt << New Column("Ratio", Numeric, Continuous);
col1 << Formula(:height / :weight);
wait(1);

For Each({col_name}, dt << Get Column Names("String"),
	col = Column(dt, col_name);
	If(!Is Empty(col << get formula),
		Column(dt, col_name) << Delete Formula
	);
);

Scripting Index has a lot of information and you can find it directly from JMP's menu Help / Scripting Index

jthi_0-1670526823473.png

If you add those formulas yourself and don't really need them for formula usage, you can avoid adding them all together by using << Set Each Value()

-Jarmo

Re: How to determine a column has formula?

It worked!

Thank you so much!

Recommended Articles