I don't understand this SQLstatement

I don't understand this SQLstatement

  

I have trouble doing the last part of the web developer tutorial, the booking assignment no. 4. I don't understand the use of "@" in this statement. i try to apply the steps to used the SQL statement in the previous tutorial but it does not work.

please help me with this SQL statement and i'm new in this web developer

thanks

Hi, 

This is a query parameter. You use them to pass values from the code to inside the query. Same as the input parameter in a page or action.

You create them in the Patameters folder in the query.

In the web online tutorial, in the presentation about the Aggregates and SQL this is explained.

Cheers.

Eduardo Jauch wrote:

Hi, 

This is a query parameter. You use them to pass values from the code to inside the query. Same as the input parameter in a page or action.

You create them in the Patameters folder in the query.

In the web online tutorial, in the presentation about the Aggregates and SQL this is explained.

Cheers.

thank you for replied.

I already solved the problem by try & error and carefully read the instruction given and yeah, I check back the slide presentation and it already been explained, my bad for not pay attention during the presentation.

but now I have another problem. the SQL statement that I asked before are used to show the room number and the price of that room (both are also in the form)as the user click the "Get Available Room" button but it doesn't show up.

I used the expression widget to show the room number and the price using the info returned by the Query. So in my expression value I wrote this:
the AvailableRoom is the name for the SQL statement and the GetAvailableRoom is the Output entities/structure in the query. Is this correct?

and I have to create a screen action right for the "Get Available Room" button using the CreateOrUpdateBooking action, right?

Hi Taufiq,


What the output of query? It is Room entity type, right? 

In your screen action, maybe you need some logic to booking a room. You don't need to verify if room stay available when click the button? After some validations (I think), you can use CreateOrUpdateBooking action to save the booking.

Solution

Hello Taufiq,

The solution is more simple.

You have two situations possible for your booking detail page

1. New booking

2. Existing booking

In the second case, the aggregate in preparation will find a booking, the form will have the information in its Record, and you wanna to show this information in the form. In this case, the RoomId, present in the Booking entity, exist (the room was already selected previously). How to show the Number and price of room?

If you remember, the Record of the form will be of the same type of its source, that in this case, is the GetBookingById.List.Current (from preparation).

If your aggregate has only a single entity Booking, the form record will be of type Booking.

But if you join the Booking with Room in that aggregate, now your Form Record will have both booking and Booking and Room. At this point you may need to fix the inputs in the form (they will need the entity name after the Record and before the attribute name).

So, you can use the Form.Record.Room.Number and so on to show the number and price in the form.

Now the first case, a new booking. The info about the room does not exists initially. But the Form.Record has the Room entity and its using to show. So, in the GetAvailableRoom action, after the sql, assign the room number and price to the Form.Record.Room.Number and so on.

If your button is set to Submit, the number and price will automatically appear to the user.

Cheers

Solution

CreateOrUpdateBooking will be used in a different action (called from a different button).

thank you for the tips. i already solved the problem