|
Best of Support |
|
|
Refreshing a drop-down List |
|
Issue
I have a drop-down List (SelectedName) on a Dialog (Master). Based on the answers in a collection (Names) on the same form, I want to create or refresh the drop-down List (TempList).
Is there a way to tell SelectedName to refresh its List on the same dialog?
Solution
There is a new method in 4.2.3, ThisDialog.RefreshField("Fieldname"), which is particularly useful in this case. So this is what we would recommend:
In your Dialog, create your drop-down List field (e.g.,"ListOfNames") in the normal way. Point it to a List called "TempList" in the appropriate location. This List can be empty to begin with.
In the OnExit Event of your Collection field ("Names"), execute the following script:
// Load the list in to memory:
%[TempList=Lists.Select("\DDS", "TempList")]
// Clear the list values:
%[TempList.Clear('*', '*')]
// Repopulate the list from the dialog collection (item, result)
%[ForEachBlock("Name", ThisDialog.Names)]
%[TempList.Add(Name.FirstName, Name.FirstName)]
%[EndBlock]
// Save the repoplulated list
%[TempList.SaveAs("\DDS", "TempList")]
// Refresh the drop-down field
%[ThisDialog.RefreshField("ListOfNames")]
Dan Todes