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