Subscribe Bookmark RSS Feed

Append a transformed variable to a col list box

anne_sa

Community Trekker

Joined:

Feb 24, 2016

Hello everyone,

 

I can't add a transformed variable to a col list box when I use the "Append" function.

 

Here is an example:

 

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window( "Col List Box Example 3",
       H List Box(
             ll1 = Col List Box( all ),
             Button Box( "Add", ll2 << append( ll1 << get selected ) ),
             ll2 = Col List Box( "numeric", MaxItems( 1 ), nlines( 1 ) ),
             Button Box( "Remove", ll2 << remove selected )
       )
);

 

 

Then for instance I right click on the variable "height" > "Transform" > "Log"

 

When I select the new variable "Log[height]" and click on the "Add" button nothing happen...

 

Do you have any idea of how I could change that?

 

Thanks in advance for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Wendy_Murphrey

Joined:

Jun 23, 2011

Solution

Hello,

 

Unfortunately, there is no JSL support for transformed columns in ColListBox at this time.  The suggestion has been submitted to the JMP Development team for consideration in a future release.

 

In the meantime, you could add a check to verify that the column exists.  If it does not, then put up a message to instruct the user that transformed variables must be added to the data table.  To do so, right-click on the transformed column and select Add to Data Table.

 

 

New Window( "Col List Box Example 3",
  H List Box(
    ll1 = Col List Box( all ),
    Button Box( "Add",
           colList = dt << Get Column Names( String );
           If( Contains( colList, (ll1 << Get Selected)[1] ),
               ll2 << append( ll1 << get selected ),
               Caption( "Transformed variables must be added to the data table" )
           );
    ),
   ll2 = Col List Box( "numeric", MaxItems( 1 ), nlines( 1 ) ),
   Button Box( "Remove", ll2 << remove selected )
  )
);

 

 

I hope this helps.

 

Wendy

Wendy
3 REPLIES
Wendy_Murphrey

Joined:

Jun 23, 2011

Solution

Hello,

 

Unfortunately, there is no JSL support for transformed columns in ColListBox at this time.  The suggestion has been submitted to the JMP Development team for consideration in a future release.

 

In the meantime, you could add a check to verify that the column exists.  If it does not, then put up a message to instruct the user that transformed variables must be added to the data table.  To do so, right-click on the transformed column and select Add to Data Table.

 

 

New Window( "Col List Box Example 3",
  H List Box(
    ll1 = Col List Box( all ),
    Button Box( "Add",
           colList = dt << Get Column Names( String );
           If( Contains( colList, (ll1 << Get Selected)[1] ),
               ll2 << append( ll1 << get selected ),
               Caption( "Transformed variables must be added to the data table" )
           );
    ),
   ll2 = Col List Box( "numeric", MaxItems( 1 ), nlines( 1 ) ),
   Button Box( "Remove", ll2 << remove selected )
  )
);

 

 

I hope this helps.

 

Wendy

Wendy
msharp

Super User

Joined:

Jul 28, 2015

Col List Box()'s support drag and drop functionality.  So you could always replace the Add button with a Text Box that says "Please drag and drop:".

However, the bigger issue is that the transform function is even available by right clicking in the Col List Box().  Mainly b/c I'm not sure what you are doing when you do this.  One thing is for sure though, you clearly aren't creating a new transformed column in the data table.  The data table doesn't change.  All it seems is that the user can now create hocus pocus columns, and then drag and drop them into the analysis field.  This would then crash your application unless you add functionality to handle these imaginary columns by creating them.

To make it not crash when ever the user hits the run button with a fake column, you'd have to perform a check to see if the selected column even exists (similar to W. Murphrey's code).  If the column doesn't exists, you'd have to create it.  Since an end user could potentially right click and do a transformation on a transformations your code would have to be robust enough to handle this.  Once you implement this, the end user will know they can right click and create columns before analysis, they will also see the additional functions, so you'd need to create more functionality for Aggregation, Distributions, Rows, and Formula.  Unfortunately, since you have no way of knowing how they wanted to change the Formula for a column created, you'd best realize this is a wormhole.

I would say it's best to ignore this, and wait till SAS can implement it as W. Murphrey indicates they will in later versions.  If your end user absolutely needs to be able to do transforms on columns before analysis, just give them access to the data table.

anne_sa

Community Trekker

Joined:

Feb 24, 2016

Thank you for your answers W. Murphrey and msharp.

For now, checking that the variable is in the table and if not, saying to the user that he has to add it, seems to be a good way to handle my problem.

I am gonna try this !

Thanks again.