cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
adam
Level IV

Creating Multiple Dependent Columns and assign formula

Hi,

 

I have the following table and I would like to automate result columns based on the formula used.

SerialMain_radSNR_Sub_rad0SNR_Sub_rad1SNR_Sub_rad2SNR_OK_NGAmp_Sub_rad0Amp_Sub_rad1Amp_Sub_rad2Amp_OK_NG
XWW0010252323 535 
XWW0011302728 535 
XWW0012262827 352 
XWW0030232426 244 
XWW0031222526 333 
XWW0032242425 245 
XWW0060302827 454 
XWW0061292930 343 
XWW0062252826 255 

 

 

 

In this case, my SNR_OK_NG column will take the result from SNR_Sub_rad0 to SNR_Sub_rad2 which means that it require a formula. 

Usually I compute this formula manually -> If( Sum( :SNR_Sub_rad0 > 26,  :SNR_Sub_rad1 > 26, : :SNR_Sub_rad0 > 26 ) >= 2,
1, 0
);

Since I am dealing with more than 10 Pass/Fail condition on weekly basis that involves either based on single column or multiple columns results computation, it will be easier to do it once and for all instead of manually insterting columns and using formula to get the result.

Please suggest a way to do it.

Thanks.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
adam
Level IV

Re: Creating Multiple Dependent Columns and assign formula

Hi Guys,

 

Sorry, I think I have found an easy way to do it.

 

dt = Current Data Table();
New column ("SNR_OK_NG",
formula (If( Sum( :SNR_Sub_rad0 > 26, :SNR_Sub_rad1 > 26, :SNR_Sub_rad2 > 26 ) >= 2,
	"NG",
	"OK"
		)
	)
);
New column ("AMP_OK_NG",
formula (If( Sum( :Amp_Sub_rad0 > 4, :Amp_Sub_rad1 > 4, :Amp_Sub_rad2 > 4 ) >= 2,
	"NG",
	"OK"
		)
	)
);
New column ("Noise_Asyn_OK_NG",
formula (If( :Noise_Asym > 2000,
	"NG",
	"OK"
		)
	)
);

 

 

So it's good now.. :)

Welcome any suggestion/method as well.

 

Thanks.

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Creating Multiple Dependent Columns and assign formula

I am not sure what you are asking for.  Are you just looking for a script that creates these columns for you?

Jim
adam
Level IV

Re: Creating Multiple Dependent Columns and assign formula

Hi Jim,

 

Sorry if my previous explanation is confusing. I'm attaching a sample file. 

 

Usually this is my raw file from database as shown below:

SerialMain_radSNR_Sub_rad0SNR_Sub_rad1SNR_Sub_rad2Amp_Sub_rad0Amp_Sub_rad1Amp_Sub_rad2Noise_Asym
XWW00102523235352001
XWW00113027285351830
XWW00122628273521656
XWW00302324262441246
XWW00312225263332142
XWW00322424252451930
XWW00603028274541673
XWW00612929303431887
XWW00622528262551680

 

Every time during my analysis, I will have to manually add the _OK_NG columns(with formula) in order to get its status as shown below:

SerialMain_radSNR_Sub_rad0SNR_Sub_rad1SNR_Sub_rad2SNR_OK_NGAmp_Sub_rad0Amp_Sub_rad1Amp_Sub_rad2Amp_OK_NGNoise_AsymNoise_Asym_OK_NG
XWW0010252323OK535NG2001NG
XWW0011302728NG535NG1830OK
XWW0012262827OK352OK1656OK
XWW0030232426OK244OK1246OK
XWW0031222526OK333OK2142NG
XWW0032242425OK245OK1930OK
XWW0060302827NG454OK1673OK
XWW0061292930NG343OK1887OK
XWW0062252826OK255NG1680OK

 

 

Now I intended to get a script to automate - by adding _OK_NG_columns with its status. For the Noise_Asym status, I can get a script for it but those Sub_rad, I can't find a way out.

 

Thanks.

 

 

adam
Level IV

Re: Creating Multiple Dependent Columns and assign formula

Hi Guys,

 

Sorry, I think I have found an easy way to do it.

 

dt = Current Data Table();
New column ("SNR_OK_NG",
formula (If( Sum( :SNR_Sub_rad0 > 26, :SNR_Sub_rad1 > 26, :SNR_Sub_rad2 > 26 ) >= 2,
	"NG",
	"OK"
		)
	)
);
New column ("AMP_OK_NG",
formula (If( Sum( :Amp_Sub_rad0 > 4, :Amp_Sub_rad1 > 4, :Amp_Sub_rad2 > 4 ) >= 2,
	"NG",
	"OK"
		)
	)
);
New column ("Noise_Asyn_OK_NG",
formula (If( :Noise_Asym > 2000,
	"NG",
	"OK"
		)
	)
);

 

 

So it's good now.. :)

Welcome any suggestion/method as well.

 

Thanks.

Re: Creating Multiple Dependent Columns and assign formula

Can you set up the data table that you want manually to make sure that it is what you want and all the formulas work as expected?

 

If you can, then the next question is, "Is that table enough?" Can it be re-used as a template with new data but the same columns and formulas? This simple approach satisfies many situations.

 

If not, then use the completed data table as a template for your script. (Jim has started that approach here.)