190
Views
5
Comments
Solved
New to Outsystems - Bookings Assignment
Question

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

2021-03-05 13-56-11
Ricardo Pereira
 
MVP
Solution

Hi,


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

UserImage.jpg
Colin Douglass

Ricardo Pereira wrote:

Hi,


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

Thanks Ricardo, that worked.,


2019-03-22 17-55-12
Hugo Menino Aguiar

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! :) 


UserImage.jpg
Colin Douglass

Hugo Menino Aguiar wrote:

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! :) 


Thanks Hugo, that worked.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.