cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
shaira
Level IV

In Split data table fucntion, how to input variable in "Remaining Columns" ?

Hi,

I am making a script where the user inputs columns using a GUI and then the script splits the input table and make some correlation plots. The user input is very similar to the what the regular JMP Split function needs. My code for splitting looks something below, where remcol = "Drop all" or remcol="Keep all", depending on the user input.

 

Splitdt = dt << Split(
                      Split(Eval(parcollist)),  // the column to split
                      Group(Eval(grpcollist)),
                      ColID(Eval(splitcoln)),   
                      Remaining Columns(Eval(RemCol)),
                      Output Table Name((dt<<Get Name)||" Split")            
                     );

The script above does not work, but this works.

Splitdt = dt << Split(
                      Split(Eval(parcollist)),  // the column to split
                      Group(Eval(grpcollist)),
                      ColID(Eval(splitcoln)),   
                      Remaining Columns("Drop all"),
                      Output Table Name((dt<<Get Name)||" Split")            
                     );

Now my question is, how to I input the user preference for Remaining Columns as a variable? If I input the variable, it does not work, but typing would work. Unfortunately, this would take away the script flexibility, that is why I prefer using variable as input.

 

Thanks,

Shaira

 

1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User (Alumni)

Re: In Split data table fucntion, how to input variable in "Remaining Columns" ?

Which Version of JMP are you using?  I know that JMP 9 and later use Split By()  versus Col ID()

 

If you have a much older version of JMP,  I am not sure this will work.

Eval( EvalExpr( Splitdt = dt << Split(
                      Split(Expr(parcollist)),  // the column to split
                      Group(Expr(grpcollist)),
                      ColID(Expr(splitcoln)),   
                      Remaining Columns(Expr(RemCol)),
                      Output Table Name((dt<<Get Name)||" Split")            
                     )
        )
);

You cal keep the Eval() around the "list" variables, however, I used Expr() to make the syntax consistent.

 

Note: if you decide to allow users to select columns to keep, I'll assume there would be a list of names or column references called keepColList. Then you can use something like this to define the remaining columns with the script above.

remcol = Expr(Parse("Keep(" ||char(keepColList) || ")"));

 

View solution in original post

2 REPLIES 2
gzmorgan0
Super User (Alumni)

Re: In Split data table fucntion, how to input variable in "Remaining Columns" ?

Which Version of JMP are you using?  I know that JMP 9 and later use Split By()  versus Col ID()

 

If you have a much older version of JMP,  I am not sure this will work.

Eval( EvalExpr( Splitdt = dt << Split(
                      Split(Expr(parcollist)),  // the column to split
                      Group(Expr(grpcollist)),
                      ColID(Expr(splitcoln)),   
                      Remaining Columns(Expr(RemCol)),
                      Output Table Name((dt<<Get Name)||" Split")            
                     )
        )
);

You cal keep the Eval() around the "list" variables, however, I used Expr() to make the syntax consistent.

 

Note: if you decide to allow users to select columns to keep, I'll assume there would be a list of names or column references called keepColList. Then you can use something like this to define the remaining columns with the script above.

remcol = Expr(Parse("Keep(" ||char(keepColList) || ")"));

 

shaira
Level IV

Re: In Split data table fucntion, how to input variable in "Remaining Columns" ?

Thanks @gzmorgan0! This is very helpful.

I am using JMP12 but I think I was reading old documentation, that is why I used ColID.

 

Although for the RemCol expression, Char() Function did not work. What worked was below expression:

RemColExpr=Expr(Parse("Keep("||Concat Items(ColSellist,",")||")"))