How to Add Items to a Drop Down List?

Your rating: None Average: 2.3 (3 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
   &AddrType = FetchValue(Scroll.PERSON_ADDRESS, &i, PERSON_ADDRESS.ADDRESS_TYPE);
   IF &AddrType <> "HOME" Then
      &Level1(&i).Visible = False;
   Else
      &addrHomeFound = "Y";
   End-IF;
End-FOR;

/*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 */
   DERIVED_CO.ADDR_TYPE_DESCR.Visible = False;
Else
   /* Clear drop down list and then show only "Home" */
   DERIVED_CO.ADDR_TYPE_DESCR.ClearDropDownList();
   DERIVED_CO.ADDR_TYPE_DESCR.AddDropDownItem("HOME", "Home");
End-IF;

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!

Comments

Have a question? Please ask it on the forum instead.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
The question below is to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.