How to Add Items to a Drop Down List?

Your rating: None Average: 3 (27 votes)

The PeopleCode below will do couple things. First, it will restrict grid on a page to show only rows of address type "HOME". Second, allow users to only be able to add a "Home" mailing address by restricting the values in the drop down list to show only "Home" by using the ClearDropDownList and AddDropDownItem properties.

/* Hide Rows on the grid for any thing that is not of Address Type "HOME" */
FOR &i = 1 TO &Level1.ActiveRowCount
   IF &AddrType <> "HOME" Then
      &Level1(&i).Visible = False;
      &addrHomeFound = "Y";

/*Users will only be able to add a "Home" mailing address, so restrict the values in the drop down to show only "Home"*/
IF &addrHomeFound = "Y" Then
   /* home mailing address already there, no need to show the drop down menu */
   /* Clear drop down list and then show only "Home" */
   DERIVED_CO.ADDR_TYPE_DESCR.AddDropDownItem("HOME", "Home");

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!