Friday, March 27, 2015

Dexterity template for filling a user-defined drop down list

{
Assumptions
Window = Maintenance
Type = the drop down list
TypeName = a string
Type_MSTR = table with the user-defined type strings

}

local TypeName curChoice; {Save the currently selected value in case the user added more values to the table after choosing an option in the dropdown}

default window to Maintenance;

if not empty(Type) then
curChoice = itemname(Type, Type);
end if;

clear Type;

call SetRangeTypeMSTR of form TypeAPI, table Type_MSTR;
get first table Type_MSTR by number 1;
while err() = OKAY do

add item TypeName of table Type_MSTR to field Type;

get next table Type_MSTR by number 1;
end while;

Type = finddata(Type, curChoice);
if empty(Type) and countitems(Type) > 0 then
Type = 1;
end if;

No comments:

Post a Comment

There was an error in this gadget