cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
SpannerHead
Level III

Copy Selected Column Values

I have a JMP table that contains categories, subcategories and spec limits that I need to reference in a data table.  I'm sure there are many ways to do this but I wrote formulas in two added columns that converts to a JMP script when the columns are selected and the values pasted into an empty JMP script.

 

Added Column 1 contains the formula-

 

If(Row() == 1,
	"dt=Current Data Table();"
)

 

Added Column 2 contains the formula-

 

 

"Try(Eval(Eval Expr( :" || :Process || " << Set Property( \!"Spec Limits\!", {LSL( "
|| Char( :LSL ) || " ), Target( " || Char( :Target ) || " ), USL( " || Char( :USL )
|| " ), Show Limits( 1 )} ))););";
"Try((Column(\!"" || :Process || "\!") << Set Selected(1););dt << group columns(\!""
|| :TYPE || "\!");dt << deselect column group( \!"" || :TYPE || "\!" ););" ||
"Try(Eval(Eval Expr(:" || :Process || " << Set Property(\!"Notes\!", \!"" ||
:Subgroup || "\!"))););";

 

Process is the property name Column.  This will be coherent with the data column names in the data table.

LSL is the lower spec limit Column.

USL is the upper spec limit Column.

Type is the group Column.

Subgroup is the notes Column.

 

I am able to manually select the columns, do a copy and paste, which gives a working script.  To add the next layer of automation I wanted to have the script select and copy the values from the two target columns, open the script window and paste the content.

 

Where I'm stuck is on getting the script to copy and paste the values contained in the columns?

 

Any help appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
SpannerHead
Level III

Re: Copy Selected Column Values

I had a discussion with one of my colleagues at work (thanks Tom) and we figured this out.  I need to drop the formula from the columns of interest and then do a copy and paste.

 

After creating the column, I add

	Column( "Added Column") << Delete Formula;

Then I copy the contents, open a script window and paste the contents.

 

Current Data Table() << Bring Window To Front;
Wait(0);
Main Menu("Copy");
ww=New Window( "Script", <<Script );
Wait(0);
Main Menu("Paste");

I might go back and delete the columns from the parent reference table since they're now redundant but that's just housekeeping.

 

 

View solution in original post

5 REPLIES 5
mmarchandTSI
Level V

Re: Copy Selected Column Values

So you want to end up with an automatically-generated script in a new script window, right?  Can you post an example table to start with?

 

Also, the <JSL> button should be used when posting JSL code so it's easier to read and digest.

SpannerHead
Level III

Re: Copy Selected Column Values

First post from me sorry, for the confusion.

jthi
Super User

Re: Copy Selected Column Values

I think using Table Script or just JMP script file (.jsl) would make this easier (you can also make a toolbar/add-in if needed).

-Jarmo
SpannerHead
Level III

Re: Copy Selected Column Values

I am placing the resulting values in a script and it runs as intended, I could convert to an add-in also.  What I wasn't able to figure out was how to avoid manual activity in the first place.  At it's most basic, I was trying to replicate the Ctrl+C and Ctrl+V functions after having automatically created and selecting the columns.  Anything I find in the scripting langauge copies and pastes the formula rather than the values.

SpannerHead
Level III

Re: Copy Selected Column Values

I had a discussion with one of my colleagues at work (thanks Tom) and we figured this out.  I need to drop the formula from the columns of interest and then do a copy and paste.

 

After creating the column, I add

	Column( "Added Column") << Delete Formula;

Then I copy the contents, open a script window and paste the contents.

 

Current Data Table() << Bring Window To Front;
Wait(0);
Main Menu("Copy");
ww=New Window( "Script", <<Script );
Wait(0);
Main Menu("Paste");

I might go back and delete the columns from the parent reference table since they're now redundant but that's just housekeeping.