cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
djhanson
Level V

Data Table to Table Box (easier way?)

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)
);

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Data Table to Table Box (easier way?)

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;


View solution in original post

2 REPLIES 2
djhanson
Level V

Data Table to Table Box (easier way?)

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 (Alumni) ms
Super User (Alumni)

Re: Data Table to Table Box (easier way?)

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;