Remove options from Dynamic List
After searching the forums for a few weeks I failed to find a solution to the problem.
I have a student database with 3 forms, registration, module & lesson update.
In my lesson update form i have 2 lookup fields and 1 dropdown.
Studentname = Lookup, populated from registration form.
Currentcourse = Lookup, populated from module form.
Currentmodule = Dropdown
What i wanted to do was create the dropdown for Currentmodule from the module form, so once a record was created for a student the next time i created a record for the same student the Currentmodule dropdown list would only display modules not completed.
Here is the code I finally got to work, I placed it in "on user input" of the Currentcourse field;
-
if (count(Module[Course_Name == input.Current_Course]) == 0)
{
clear Current_Module;
}
else
{
workingList = List:String();
for each cml2 in Module [Course_Name == input.Current_Course]
{
workingList.add(cml2.Module_No);
}
for each cml in Lesson_Update1 [Student_Name == input.Student_Name]
{
workingList.removeelement(cml.Current_Module);
if (!workingList.contains(cml.Student_Name))
{
workingList.removeelement(cml.Current_Module);
}
}
Current_Module:ui.add(workingList);}
If anyone has a better way of acheving this please let me know.
Hope this helps... :)
Damien