Subscribe Bookmark RSS Feed

Elevator Bars on Table Boxes?

I have window containing a Table Box. That Table Box displays a set of summary statistics relating to a data table that I select from a list of such tables, and contains as many rows as there are columns in my data table. I don't know in advance how many columns there are going to be in the data table, so I don't know how many rows my Table Box is going to need. This isn't a problem, as the Table Box simply expands or contracts to accommodate the number of rows it contains. However, I want to limit the number of rows to 20 (so that my window doesn't run off the bottom of the screen), and insert a vertical elevator bar to the right of the Table Box if it's needed - in the same way that such a bar will automatically appear on a List Box if the number of elements in the list exceeds the NLINES parameter.

Is this possible? I can't see any property of a Table Box that would enable me to do it directly, and I can't think of a way to surround the Table Box with some sort of frame to which an elevator bar could be attached.

Many thanks for any suggestions.

2 REPLIES
ms

Super User

Joined:

Jun 23, 2011

If your tablebox only has a few columns one idea would be to trick a listbox to look like a table box by inserting tabs. See a simple example below. I inserted a conditional egument for the number of tabs to get the impression of a justified table. (this could be improved and generalized, for example by using som regex loops that insert space to match up with longest word in the left column).

Open( "$ENGLISH_SAMPLE_DATA/Baltic.jmp" );

Data Table( "Baltic" ) << Summary(

          Group,

          Mean( :v1 ),

          Mean( :v2 ),

          Mean( :v3 ),

          Mean( :v4 ),

          Mean( :v5 ),

          Mean( :v6 ),

          Mean( :v7 ),

          Mean( :v8 ),

          Mean( :v9 ),

          Mean( :v10 ),

          Mean( :v11 ),

          Mean( :v12 ),

          Mean( :v13 ),

          Mean( :v14 ),

          Mean( :v15 ),

          Mean( :v16 ),

          Mean( :v12 ),

          Mean( :v18 ),

          Mean( :v19 ),

          Mean( :v20 ),

          Mean( :v21 ),

          Mean( :v22 ),

          Mean( :v23 ),

          Mean( :v24 ),

          Mean( :v25 ),

          Mean( :v26 ),

          Mean( :v27 )

);

dt1 = Data Table( "Summary of Baltic" ) << Transpose(

          columns(

                    :Name( "Mean(v1)" ),

                    :Name( "Mean(v2)" ),

                    :Name( "Mean(v3)" ),

                    :Name( "Mean(v4)" ),

                    :Name( "Mean(v5)" ),

                    :Name( "Mean(v6)" ),

                    :Name( "Mean(v7)" ),

                    :Name( "Mean(v8)" ),

                    :Name( "Mean(v9)" ),

  :Name( "Mean(v10)" ),

  :Name( "Mean(v11)" ),

  :Name( "Mean(v12)" ),

  :Name( "Mean(v13)" ),

  :Name( "Mean(v14)" ),

  :Name( "Mean(v15)" ),

  :Name( "Mean(v16)" ),

  :Name( "Mean(v12)" ),

  :Name( "Mean(v18)" ),

  :Name( "Mean(v19)" ),

  :Name( "Mean(v20)" ),

  :Name( "Mean(v21)" ),

  :Name( "Mean(v22)" ),

  :Name( "Mean(v23)" ),

  :Name( "Mean(v24)" ),

  :Name( "Mean(v25)" ),

  :Name( "Mean(v26)" ),

  :Name( "Mean(v27)" )

          ),invisible

);

Column( dt1, 2 ) << set name( "Mean" );

//Set label

lst = {Eval( Column( dt1, 1 ) << get name ) || "                    " || Eval( Column( dt1, 2 ) << get name )};

//Populate list, conditional number of tabs between columns.

For Each Row(

  Insert Into(

                    lst,

                    Char( :Label[] ) || "          " || If( Length( :Label[] ) < 9, "          ", "" ) || Char( :Mean )

          )

);

nw = New Window( "\!"Table box\!"", lb = List Box( Eval List( lst ), nlines(20) ) );

And of course one nice little by-product of that would be the built-in ability to select one or more rows of the resulting summary table - which actually would be remarkably useful to me in the present context.  I can infer however that there probably isn't an easier way of doing it, so for the time being I'll probably just put up with the indeterminate length of the table; nevertheless it looks like it could be worthwhile spending some time writing a general function to generate such a display from any given table box with any specified number of rows and columns.  It may however have to wait until the Christmas break!

Thank you - that's very helpful.

David