“Get Available Room button gets the lowest room information that meets the reservation conditions and displays the corresponding room information.”
Is it correct to use Is.Active when defining the above?

Hello Kusaka,

Please, try to make your posts title more self explanatory... :)

Also, how do you pretend to use this Is.Available thing?

Cheers

Eduardo Jauch wrote:

I'm sorry

Get Available Room is a button that allows guests to search for rooms to make a hotel reservation.
For that purpose, I made SQL definition because I wanted to get the lowest room information meeting reservation conditions and to display the corresponding room information.
After getting the lowest room information from the SQL query, I need to set the room information returned by SQL to a variable in the Form widget. Please let me know how.


Hello Kusaka,

Please, try to make your posts title more self explanatory... :)

Also, how do you pretend to use this Is.Available thing?

Cheers



Hi,

As you will use the Booking entity from the Form's Record as the source when creating the booking in the database, you have to set the Room ID in the Form.Record.Booking.RoomId.

Cheers.

Kusaka Yui wrote:

I'm sorry

Get Available Room is a button that allows guests to search for rooms to make a hotel reservation.
For that purpose, I made SQL definition because I wanted to get the lowest room information meeting reservation conditions and to display the corresponding room information.
After getting the lowest room information from the SQL query, I need to set the room information returned by SQL to a variable in the Form widget. Please let me know how.

Hello Kusaka,

you need to assign the returned values from the SQL query (green border in my screenshots) to the Form. For that you place an assign (red border in screenshots) after the SQL query.


In the assign, you need to open the window to select a variable and navigate to the "widgets" folder, then find and select the "room" entity within the Form's record (see screenshot below).

After that, you assign the current record from the SQL query's output to the form's record. Since the names don't match up, you have to map the assignment of output's attributes to the "room" entity's attributes like in the orange bordered section. 

I hope this helps & best regards,
Michael

Michael Segbers wrote:

Thank you for a polite answer.
I have one more question

The Get Available Room button is pressed to search for vacancies, and the Book Room button is pressed to make a reservation. Which of the two button actions would you like to define?

Kusaka Yui wrote:

I'm sorry

Get Available Room is a button that allows guests to search for rooms to make a hotel reservation.
For that purpose, I made SQL definition because I wanted to get the lowest room information meeting reservation conditions and to display the corresponding room information.
After getting the lowest room information from the SQL query, I need to set the room information returned by SQL to a variable in the Form widget. Please let me know how.

Hello Kusaka,

you need to assign the returned values from the SQL query (green border in my screenshots) to the Form. For that you place an assign (red border in screenshots) after the SQL query.


In the assign, you need to open the window to select a variable and navigate to the "widgets" folder, then find and select the "room" entity within the Form's record (see screenshot below).

After that, you assign the current record from the SQL query's output to the form's record. Since the names don't match up, you have to map the assignment of output's attributes to the "room" entity's attributes like in the orange bordered section. 

I hope this helps & best regards,
Michael



Hey Kusaka,

all of the above happens within the "GetAvailableRoom" screen action that's triggered by the "Get Available Room" button. You already said you are making the SQL query in that screen action and I mentioned that you need to make the assign after the SQL query (the first screenshot shows it to be in the same action).

For reference, here is the complete "GetAvailableRoom" screen action I am using, including the SQL query and the folloing assign:

Best regards,
Michael

Michael Segbers wrote:

Thank you!!

If you have any questions, I will ask you questions.

Hey Kusaka,

all of the above happens within the "GetAvailableRoom" screen action that's triggered by the "Get Available Room" button. You already said you are making the SQL query in that screen action and I mentioned that you need to make the assign after the SQL query (the first screenshot shows it to be in the same action).

For reference, here is the complete "GetAvailableRoom" screen action I am using, including the SQL query and the folloing assign:

Best regards,
Michael



Michael Segbers wrote:

What is the correct way to specify each of the SQL properties?




Hey Kusaka,

all of the above happens within the "GetAvailableRoom" screen action that's triggered by the "Get Available Room" button. You already said you are making the SQL query in that screen action and I mentioned that you need to make the assign after the SQL query (the first screenshot shows it to be in the same action).

For reference, here is the complete "GetAvailableRoom" screen action I am using, including the SQL query and the folloing assign:

Best regards,
Michael



Hey Kusaka,

I am by no means a SQL expert, but for this specific excercise I believe this should be what you are looking for:

Note that you seem to have one Input Parameter more than I do ("BookedStatus"). In that case, you should be able to just assign it the equivalent of the "CanceledStatus" Input Parameter.

This is the SQL query I used with the above Input Parameters:

Best regards,
Michael

Michael Segbers wrote:

What should I set for each widget?

I thought about it, but it was complicated and difficult.

Hey Kusaka,

all of the above happens within the "GetAvailableRoom" screen action that's triggered by the "Get Available Room" button. You already said you are making the SQL query in that screen action and I mentioned that you need to make the assign after the SQL query (the first screenshot shows it to be in the same action).

For reference, here is the complete "GetAvailableRoom" screen action I am using, including the SQL query and the folloing assign:

Best regards,
Michael



Kusaka Yui wrote:

What should I set for each widget?

I thought about it, but it was complicated and difficult.

Hey Kusaka,

you need to be more specific in your question, I am not sure what you mean by that. At least give a reference number for the task you are working on and what do you mean by "what"? There are many things you could set for a widget.

Also, we seem to have moved away from a specific troubleshooting question to a step-by-step walkthrough of the online course's final project. You should check the sub forum for the online courses to see if they already answer your questions. https://www.outsystems.com/forums/59/developer-online-courses-discussion/

Best reagrds,
Michael