Script to select columns from a list in clipboardHere is my script (based on help from you all!) which works nicely , in this case to select columns "Aasdh,Abca2,Abca7,Abcf1,Abi3" in a data table.
My new problem: When I have a large list of column names in my clipboard, I dont' want to have to type or convert to names separate by columns as shown in t script here. Instead I want the script to use the clipboard directly to select the columns in the data frame.
How can one convert the clipboard list into "Aasdh,Abca2,Abca7,Abcf1,Abi3...." directly within the script?
thanks!
SCRIPT
//with data table where you want to select the columns now open
Names Default To Here( 1 );
dt = currentdatatable();
// Get list of data column names
col_list = dt << Get Column Names( string );
// User specified column names
cc = {Aasdh,Abca2,Abca7,Abcf1,Abi3};
For( i = 1, i <= N Items( cc ), i++,
If( Contains( col_list, Char( cc[i] ) ),
Column( dt, Char( cc[i] ) ) << Set Selected( 1 )
)
);
Data TableScriptingRe: Script to select columns from a list in clipboardYou can use
myClipboard = Get Clipboard();
to move the list into a memory variable.....in this example, a variable called "myClipboard", and then using JSL, manipulate it as desired
If your clipboard contained the following
Aasdh,Abca2,Abca7,Abcf1,Abi3
You could retrieve it into a JMP list using
myClipboard = words(Get Clipboard(),",");
Re: Script to select columns from a list in clipboardbelated ....
My lists are copied into the clipboard from a column in JMP data frame or excel
I need the clipboard contents with e.g. 3 copies strings, columnQ, columnX, columnB to be converted to this in the script {columnQ, columnX, columnB}.
..... but all the solutions you listed result in "" around the series, and the script does not run. How to get rid of the "" ??
THANKS
myClipboard = Get Clipboard();
/*:
"columnQ
columnX
columnB"
//:*/
myClipboard = words (Get Clipboard());
/*:
{"columnQ
columnX
columnB"}
//:*/
myClipboard = words(Get Clipboard(),);
/*:
{"columnQ
columnX
columnB"}
//:*/
myClipboard = words(Get Clipboard(),",");
/*:
{"columnQ
columnX
columnB"}
Re: Script to select columns from a list in clipboardThanks for repeeated efforts to help with this. However I don't think I am being clear.
When Getclipboard gives me this...
{"Tcea1, Atp6v1h, Oprk1, Rb1cc1, Fam150a"}
I need to convert it to this
{"Tcea1", Atp6v1h", "Oprk1", "Rb1cc1, "Fam150a"} which I prefer because it would make numeric values into strings
or into this
{Tcea1, Atp6v1h, Oprk1, Rb1cc1, Fam150a}
Is there a simple way to script that transformation....?
then the script you provided in June nicely selects all the columns. Typically my lists have 100s of column labels, so I need to automate.
thanks