BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Community Trekker

for loop inside a new table

Hello Everyone,

I am pretty new to JMP and even newer to JSL. I am trying to get information from the user in a GUI and output all values up to their numerical choice and put that into a data table so that the user can have more information at once. This call for a loop of some sort and I've worked out the logic  for the loop. My question is this: how can I have the loop be inside of the table so that the multiple values can be shown? Below is the loop that returns what I need in the log. Thanks for any help or suggestions and just let me know if clarification is needed.

gui user input = 6;

for (totlots = 1, totlots <= 25, totlots ++,

if (totlots <= gui user input, show(totlots) );

log shows:

totlots =1;

totlots = 2;

totlots = 3;

totlots = 4;

totlots = 5;

totlots = 6;

0 Kudos
Super User

Re: for loop inside a new table

Perhaps you need something like this?

dt = current data table();

col_names = dt << get column names(string);

if (!contains(col_names, "Total Lots"),

    dt << new column("Total Lots", numeric);


lots_text = "";

nw = New Window( "Enter Lots",


    Panel Box( "Select number of total lots",

        lots_teb = text edit box(lots_text),


    Panel Box( "Actions",

        H List Box(

            Button Box( "OK",

                ok_button = 1;

                lots_text = lots_teb << get text;


            Button Box( "Cancel", ok_button = 0 ),




if (ok_button,

    lots_num = num(lots_text);

    nr = nrows(dt);


    if (nr < lots_num,

        dt << add rows(lots_num - nr);


    for (i = 1, i <= lots_num, i++,

        dt:"Total Lots"[i] = i;



0 Kudos
Community Trekker

Re: for loop inside a new table

This seems to be very close to what I need. Thanks!

0 Kudos