Page 1 of 1

How to clear a dropdown?

Posted: Mon Mar 11, 2013 7:15 pm
by cklee
I wonder how we can clear a dropdown. I find that if I set up a dropdown with fewer items than previous time the form is displayed, the dropdown will have remaining items still intact. For example, if a dropdown has been set up with items AAA, BBB, CCC, DDD, EEE and then set up again on next display of the same form with items FFF, GGG. The resulting dropdown will contain items FFF, GGG, CCC, DDD, EEE.

Re: How to clear a dropdown?

Posted: Tue Mar 12, 2013 11:26 am
by Mark_Dale
Hi CK,

You can clear a drop down with logic like this:

(Say the Dropdown's name is DDOWN1)

When (= CLEAR)
#COM_OWNER.IsNewForm := False

#Com_Owner.Set_null Property(DDOWN1.Item)

#COM_OWNER.Set_Label Name('/Form.Popover') Text('Dropdown cleared') Color(Blue)
#Com_Owner.Set_Form Show_Popover(TRUE)

Re: How to clear a dropdown?

Posted: Fri Oct 23, 2015 2:01 pm
by rgjohnson
Should this work in RPG too? I have a dropdown called SHOWROOM. It loads up fine with all entries. If the selection criteria changes their may be no valid SHOWROOMS so I want to clear the dropdown list. I tried:

LRNG_SetProperty('Item' : 'null');

That results in an error message the SHOWROOM.ITEM property is not recognized. How can I clear the dropdown if that is the only change on the form?

Re: How to clear a dropdown?

Posted: Fri Oct 23, 2015 9:35 pm
by tsupartono
Yes this would work in RPG too.

My guess is that you probably are missing 'Form.Fields' when referencing the dropdown.
The fully qualified name of the dropdown is 'Form.Fields.SHOWROOM', so you'd need to refer to the property as 'Form.Fields.SHOWROOM.Item'

To clear the dropdown entries, you can do the following:

LRNG_AssignNullToProp('/Form.Fields.SHOWROOM.Item')