How to clear a dropdown?

Please do not use to report errors- use your regional help desk.
Please mark posts as being for RPG or RDMLX (LANSA) developer.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
Post Reply
cklee
Posts: 13
Joined: Fri Feb 08, 2013 7:05 pm

How to clear a dropdown?

Post 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.
Mark_Dale
Posts: 61
Joined: Thu Apr 19, 2012 11:06 am

Re: How to clear a dropdown?

Post 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)
rgjohnson
Posts: 19
Joined: Wed May 09, 2012 11:55 pm

Re: How to clear a dropdown?

Post 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?
tsupartono
Posts: 289
Joined: Wed Apr 18, 2012 10:21 am

Re: How to clear a dropdown?

Post 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')
Post Reply