I have a field in my workorder form that allows my Dispatcher to list the names of the workers assigned to a job. He would like to be able to select multiple names off a list, sorted by seniority, to fill this field. He would also like to be able to type entries in without using the list.
I started with the code from the "Pizza Toppings" element in the practice program we created in the beginner programming class. I edited it to this:
var vWorkers as String
var vList as String
// List the Workers
vList = @Insert("Workers.txt")
// Initialize vWorkers to a value that allows
// the While loop to run
vWorkers = "start"
// As long as the user keeps selecting workers,
// keep offering the list.
While((vWorkers <> "*DONE")
And (vWorkers <> ""))
{
vWorkers = @PopupMenu(vList, "SELECT A WORKER")
If ((vWorkers <> "*DONE")
And (vWorkers <> ""))
{
Workers_Assigned_To_Job = @AppendStringArray(Workers_Assigned_To_Job, vWorkers)
}
}
This works well except that the names are sorted alphabetically, even though "Workers.txt" lists them by seniority. Also, manual entry of text is not possible; you have to pick from the popup only.
So then I tried it as a combo box. This fixes the sort problem but I can only choose one name, and any new choice replaces the previous one. I tried += but then names started duplicating themselves.
So somehow I think I need to use @AppendStringArray in the combo box to continue to add names to Workers_Assigned_To_Job, but here my Sbasic programming skills fail me. I tried putting a PopulateListElement command into the mix, and although the program editor accepted it happily, upon preview I got locked into a neverending loop which required Task Manager to break out of, and of course the .dsr was then corrupted.
Any help would be appreciated.