Hi,
I'm just starting with Outsystems and I am currently working my way through the Web Developers On-Line course. Part of the assignment is to populate a combo box with the available Room Amenities and then allow items from that list to be selected. So far so good.
My question goes a little further than the course. I want to be able to select the amenity I want but then have it removed from the combo box options so it can't be selected again. In other words, once it has been selected for a particular room it will not show up in the available amenities list either in the current or subsequent sessions. It would still be available for other rooms to select, it just won't show again for the same room.
I suppose I would have to do it in the screen action that actually creates and saves the link between Amentity and Room but I can't figure out how to do it.
Thanks in advance for any help
Col Douglass
I think that what you can do is create an aggregate in your preparation with the data that you need, use the filter in that aggregate that remove the already selected amenities and then, in your combo box properties, select that aggregate as source. Then you can create an onChange action that refresh data and ajax refresh to the combo box.
Hope this can help you.
Regards,
Ricardo
Ricardo Pereira wrote:
Thanks Ricardo, that worked.,
Hi Colin!
I'm assuming you have screen RoomAmenities created and that's where you are adding an amenity to that specific room. If that's the case a possible solution to have your Combo Box showing only amenities that were not added yet to that specific room is:
1. Use a SourceRecordList on your Combo Box (at the moment you are probably using the static entity Amenity as source).
2. The SourceRecordList should be the GetAmenities.List (you need to have an aggregate on the Preparation of RoomAmenities Screen to fetch that data from the DB).
3. Your GetAmenities need to be smart enough to fetch the right data. This aggregate needs to implement the JOIN below. I mean if A is your Amenity and B your RoomAmenity. I will leave that for you but if you struggle with it let us know.
Enjoy! :)
Hugo Menino Aguiar wrote:
Thanks Hugo, that worked.