cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
gianpaolo
Level IV

JSL create a Query dialog

hello.

my project is to create a Query dialog with JSL.

i would like to make a dialog box  where i can put a certain number of Lots  and put this  values in a variable

so.. i found the option "COL SPAN BOX"... seems useful.....but work only if i put one lot Number.

 

here the rudimental script i builted:

 

 

test = New Window( "lots query",
   <<Modal,
  <<Return Result,
  Table Box(
     Col Span Box( "Insert Lot_ID", neb = Number Col Edit Box( "Lot List", [0] ), ),
      V List Box(
         Button Box( "test" ), /
         Button Box( "OK", Lot_number = neb << Get ),
         Button Box( "Cancel" )
        )
    )
);

 

 

 

but my scope is to have the possibility to insert an undefinite numbers of lots and get the values for all of them.

how i can modify my code (or indicate me some other way) to get my scope?

 

 thanks in advance

Gianpaolo

Gianpaolo Polsinelli
1 ACCEPTED SOLUTION

Accepted Solutions
vince_faller
Super User (Alumni)

Re: JSL create a Query dialog

Yeah that's native. You don't even need to do anything. Just copy from excel and when you paste it should paste properly.
Vince Faller - Predictum

View solution in original post

3 REPLIES 3
vince_faller
Super User (Alumni)

Re: JSL create a Query dialog

This I think would work for you. 

 

test = New Window( "lots query", <<Modal, <<Return Result,
	Table Box(
		neb = Number Col Edit Box( "Lot List", J(1, 20,.) ),    
    ), 
    Buttonbox("Add Row", 
    	neb << Add Row({.});
    ),
    H List Box( Button Box( "OK" ), Button Box( "Cancel" ) )
);

//because you're using return result you can do this
values = test["neb"];
//get the values that aren't missing
non_missing = loc(ismissing(values), 0);
// set values to only the non_missing values
values = values[non_missing];

But if you can query the database in advance you can select only the lots that actually exist with something like this

 

//real query would be an open database call
//dt = open database("FAKE DATABASE", 
//	"SELECT DISTINCT LOT", 
//	"Lot Numbers"
//);

//this is just a fake table for example
dt = New Table("Lot Numbers", 
	New Column("Lot", "character", Set Values({"A12", "B36", "C465", "D234"}))
);

test = New Window( "lots query", <<Modal, <<Return Result,
	lots = column(dt, "Lot") << Get Values;
	lb_lots = listbox(lots, nlines(10), values = lb_lots << Get Selected), 
    H List Box( Button Box( "OK" ), Button Box( "Cancel" ) )
);

show(values);
Vince Faller - Predictum
gianpaolo
Level IV

Re: JSL create a Query dialog

woww!!! very nice script Vince

the first solution is the one  closest to my query dialog Query!!!!

 

 

if now i have a batch of lots.. and i want to make copy /past in the dialog box.. and get the values do you think is possible?  

 

Gianpaolo Polsinelli
vince_faller
Super User (Alumni)

Re: JSL create a Query dialog

Yeah that's native. You don't even need to do anything. Just copy from excel and when you paste it should paste properly.
Vince Faller - Predictum