Subscribe Bookmark RSS Feed

Data Table to Table Box (easier way?)

djhanson

Community Trekker

Joined:

Jun 23, 2011

Does anyone know if there is a simpler way to convert a Data Table (with both char and numeric columns) into a Table Box display box?  The only way I see is by looping thru each data table column for both the char columns and numeric columns (i.e. StringColBox, NumberColBox).  I was just wondering if there was some elusive JSL command that would take all of the Data Table contents to pass to the Table Box command.  Maybe there is no way around making a Table Box without the separate StringColBox and NumberColBoxes I suppose?  Thoughts?  thx... dj

dt_Fruit :  "Fruit" (char), "Location" (char), "Fruit Yield" (numeric), "Fruit Price" (numeric)

TableBox(
     StringColBox("Fruit",fruitvalue),
     StringColBox("Location",locationvalue),

     NumberColBox("Fruit Yield",fruityieldvalue),
     NumberColBox("Fruit Price",fruitpricevalue)
);

2 REPLIES
djhanson

Community Trekker

Joined:

Jun 23, 2011

Ok, I did manage to simplify this a bit more (but if anyone sees an even easier way, please feel free to share!):

colNamesStr = dt_Fruit<<get column names(character, nominal);

colNamesNum = dt_Fruit<<get column names(numeric, continuous);

TableBox(
     StringColBox(char(colNamesStr[1]),colNamesStr[1]<<get values),
     StringColBox(char(colNamesStr[2]),colNamesStr[2]<<get values),

     NumberColBox(char(colNamesNum[1]),colNamesNum[1]<<get values),
     NumberColBox(char(colNamesNum[2]),colNamesNum[2]<<get values)
);

ms

Super User

Joined:

Jun 23, 2011

You can get a Table Box in one sweep via Journal()

close all(journals);

dt = Open( "$ENGLISH_SAMPLE_DATA/Big Class.jmp" );

dt << journal;

New Window( eval(dt<<getname),  Current Journal()[TableBox(1)] );

// Clean up workspace

Current Journal()<<close window;