Club/Team Form: Create

Configure the club/team form to create a record.

This is the process we will follow.

CREATE

  • Add a 'create' data source for creating a single club record

  • Link the key club record identifier to this ReST API end-point if necessary

  • Map the custom variables mapped to the form fields to the data source body fields

  • Assign this 'create' data source to the data entry form

  • Configure the app toolbar Add menu to add this data entry form

  • Test that we can create a club/team using the Add menu and Update button

Add a CREATE Data Source

Open App Studio, open the Data Sources configurator, select the Teams folder you created previously, then select the previously created "Update a Team" data source request, and clone it:

The Clone Request modal popup form shows asking you to name the request:

Type a meaningful name such as "Create a Team" and click Save.

The request will be added to your tree view beneath the Teams folder:

Edit Properties

Edit the properties in the Details tab by referencing this list of ReST API end-points.

URL

https://football-891b.restdb.io/views/CreateFootballClub

HTTP Verb

The default GET verb/method is not correct for creating a single record using the ReST API and should be set to POST for this specific back-end end-point.

The request should now look like this:

Authorisation

Previously we set up security credentials at the Football folder level, so we can leave this to be set to "Inherit from parent".

We do not need to change anything else.

Body

We will be sending the data in the body of the request, and because we cloned the Update data source request, then we know that we can use that as-is:

{
    "Name": "<#TeamName#>",
    "Description": "<#Team-Description#>",
    "BadgeURL": "<#Team-Badge-URL#>"
}

Send Request

It is best practice to now click this button on the Details tab to send the request to the ReST API.

The problem however is that we would have to create an existing record in order to test this.

The best way of course to test this is to use the actual nationality form we created here, and link that form to this data source request, then we can test it.

Edit Form Properties

Open App Studio, open the Forms configurator, then select the Club form:

Click the Edit button to open the form properties modal popup.

Data Sources

Click the Data Sources tab. There are 4 CRUD data sources lines. Click this database icon to assign the Create data source:

This modal popup form appears to allow you to select the previously created data source request. Navigate through the folder hierarchy until you locate this data source request, then click the Select button.

This Create data source request should now appear in the list of assigned data source requests:

Now click the Apply button on this form, in order to persist the form properties. The Create data source request you added should be shown in the form properties list:

Note that we previously assigned the custom variables to the form fields, so we do not need to do this again, as our new data source request uses the same custom variables. We also configured the update/save button, which will automatically call the new create data source method where necessary.

Configure Add Menu

A new record can only be created from the app toolbar using the Add drop down menu:

Use this configurator to add this form to this list.

This is what your Add menu should look like in the App Toolbar Configurator after you have created the Club form. Note how you will have assigned the form as shown:

Apply

Apply any changes to persist them before testing.

Test

You can now test your configuration by clicking the Add menu button on the toolbar and selecting Club:

The Club/Team form should open:

Type in a name and the respective description. Perhaps choose a fictitious team for testing?

Click the "Click to Upload" image to upload a club badge image.

Press the Save button. The form record creation should be confirmed:

Last updated