Hi,
I know a lot of questions about Bookings Assignment(attachment) here.However, I cannot find the same questions I want to ask.
I have a trouble at "Add Amenities" at page.16.After I added Combo Box to select amenities, how can I implement to pass Combo Box's content to other screen?
At first, I can pass Combo Box content to other screen(BookingDetail screen, here) by using local variables but I can't.
Or, shouldn't I pass Combo Box's content to anywhere? Instead, should I implement CreateOrUpdateRoomAmenitiy?
I think It's a basic question but I am totally new to OutSystems.I would appreciate it if you get me a hint or an answer.
Best Regards,Mai
Hi Mai Goryo,
Using the session variable (compound data type) for holding amenity record, is not a good practice.
Refer this: https://success.outsystems.com/Documentation/Best_Practices/Performance/Performance_Best_Practices_-_Logic#Use_Session_Variables_wisely
PFA - updated .oml solution file with required code changes.
Code Correction:
- Assignment node within the save logic action flow is not correct.
- Form record should be mapped with the local variable of amenity static entity type
Hope this helps you!
Regards,
Benjith Sam
Hi Benjith Sam,
First, I really apologize to you that I reply terribly late.
Thanks to you, I finally solved my problem and it is WORKING now!!I have realized that I had the confusion or the wrong idea about variables. I'll focus to re-learn.
Thank you for your kind act to help me for many times.
Mai Goryo wrote:
No problem, It's fine :)
Happy that you got it resolved... :)
You're welcome, Mai Goryo, I'm glad I could be of help :)
Page 16 - "Add Amenities"
Objective - Create a Screen which will allow the user to add Amenities to a specific Room.
As the objective clearly states that you are trying to add a record in the database table called RoomAmenity i.e.
Record that will let us know what all are the Room Amenities available in that specific Room (ID).
The action flow for the save button will be defined as shown below, You have to use CreateOrUpdateRoomAmenity Entity action in the action flow.
Hi Benjith,
Thank you for helping me solve the problem!
However, I cannot find CreateOrUpdateRoomAmenity in the module I am developing, though I found it in the Core module.I can only see GetRoomAmenity Action in non-Core module.
I made my entities public but it seems that I did something wrong in the different setting.I'll check what I have done.
Thanks,Mai
The GetRoomAmenity Entity CRUD action are not available in the consumer module scope because the respective entity ExposeReadOnly property is set to True. You will have to create a wrapper action (set Public property to True) using the pre-defined Entity CRUD action in the Core module and reference the respective wrapper action in the consumer module for performing the CRUD operations.
Refer this post: https://www.outsystems.com/forums/discussion/60063/developing-mobile-apps-outsystems-11-4-4-exercise-problem/
Benjith Sam wrote:
Thank you for the reply!
Thanks to you, I realized that I skipped the following sentence:
"Create a Unique Index in the RoomAmenity Entity, with the RoomId and the AmenityId attributes. Make these Entities Public and set the RoomAmenity's Expose Read Only property to 'No'." (page 15 in PDF)
Then, I made it change to 'No'. I believe that this could be solved the problem.
However, I tied to 1-publish it and the error occurred(Upgrade Error: Could not create unique index on 'ROOMID,AMENITYID' of entity 'RoomAmenity'. It has duplicate values.) Anyway, this error is not related to this topic, so I'll make another post.
Thank you for your help,Mai
However, I tied to 1-publish it and the error occurred(Upgrade Error: Could not create unique index on 'ROOMID,AMENITYID' of entity 'RoomAmenity'. It has duplicate values.)Anyway, this error is not related to this topic, so I'll make another post.
Hi Mai Goryo ,
Defining a Unique Index means you are protecting the respective Entity to have any duplicate data created within itself i.e. Unique index will restrict the creation of duplicate record within a entity.
As you mentioned that, by-mistake you missed to set the unique index on RoomId and AmenityId attribute of RoomAmenity Entity, because of that very reason the entity allowed the creation of duplicate records within itself.
The error clearly state that, there exists duplicate record in the RoomAmenity Entity and because of that you can't define the unique index on RoomId and AmenityId attribute.
Solution:
- Clear/Delete the complete data residing in RoomAmenity Entity and try to define the Unique Index on RoomId and AmenityId attribute as required and publish the code changes.
Or else
- Delete the existing RoomAmenity entity and create a new table with a slight change in the entity name and define the Unique Index on RoomId and AmenityId attribute as required and publish the code changes.
Thank you for your solution!
I deleted the entity and re-created that. It works.
Then I went back to the former problem, CreateOrUpdateRoomAmenity Action.Thanks to you, I can find CreateOrUpdateRoomAmenity method in my module.
However, it is not working.When I add some amenities, they didn't show up on the display.I guess I might me wrong about Assign or CreateOrUpdateRoomAmenity source area.Do you have any suggestion that I can do?
Best regards,Mai
If possible, would you be able to share the .oml solution, so that I can easily track, what exactly the mistake is in the action flow.
I agree with Benjith Sam that the Oml might help resolve this faster. However, just a quick check on your variables assigned to your UI widgets. Are you properly assigning them before or during the CreateOrUpdateRoomAmenity?
Either create a variable of type Room Amenity and pass on to the CreateOrUpdateRoomAmenity action or create individual variables and assign all of them to the respective attributes in CreateOrUpdateRoomAmenity. I would prefer the first one.
Hi Benji,
I've attached the oml file.Could you check it please?
Hi Akshay,
Thank you for your suggesting!I checked my Assign statement and I guess it may be right...However I have zero confidence about Assign statement and CreateOrUpdateRoomAmenity action(source)Now, when I try to save amenities for a room, the error occurs :(
I would appreciate if you check my oml.
Hello,
I'm getting this error. Anyone? I'll post my oml also
Hi Carlos Soto,
The RoomId assignment node should be introduce before the Room Update Entity action as shown below.
PFA - includes the .oml file with code changes
That's the way i have it Benjith
Carlos Soto wrote:
No, Carlos. Actually the assignment node is overlapping the main flow because of that you are not able to observe the wrong flow - just drag the assignment node to the right side and see.
Note: Observe the arrow mark after each action flow node/element, these arrow indicators shows the execution flow of the logic.
Required Flow: Assign the RoomId ---> Then ----> Update the RoomEmenity Record
Corrected the flow and i get the same error.
Hi Carlos,
I observed a lot of mistake in the implemented code, apart from the previously mentioned concerns.
Code Changes:
1) You don't require a preparation action flow for this particular page, the purpose of the Add Amenities Screen is to Amenities to a particular screen based on RoomId input parameter.
2) The mapped variable to the Amenity Combobox wass incorrect - instead you should use the local variable RoomAmenity.AmenityId
PFA - includes the .oml solution with updated code
Thanks for replying.
Corrected the code to the OML that you sended me. I keep getting the same error.