Version 4.24 introduced a new feature to the Custom Forms, called SubForms. With the SubForm feature, a user may edit a table within a form. In order to utilize this new tool, the user is required to link two custom forms which target two different tables and are linked via a Foreign Key relationship. Below we will explain how to do this link and demonstrate how to use this feature.

Using SubForms

How to Create SubForms

As mentioned already, in order to use the subforms you need to create first the forms as usual, as described in the Custom Forms article. The only thing different is that in the Form Fields excel sheet, now you will find a new column SUBFORM_CODE, in which you type the code of the SubForm you created. For this article we will create two forms the ADD_BASKET and the ADD_REQUEST. With the ADD_BASKET form, the user is creating a Basket, which will contain products, and specify all the characteristics like request date, who is the requestor etc. In the ADD_REQUEST, the user is creating a request for the products mentioned above, and assigning it to an existing basket via the Basket ID.

Note: Every basket may contain multiple products.

In order to make the link between the main (ADD_BASKET) form and the SubForm (ADD_REQUEST), you need to add a new row in the Form Fields sheet of the main form, as if you are about to add a new field but in this case you have to leave the FIELD_CODE empty.

sub0

A small note, on this is the SEQUENCE column. In this example we have assigned the subform field as the third in this form. This will determine the order in the view data page and the exact place of where the table to enter data using the subform will appear. A suggestion is to set it as last, but we will demo the both cases in order to check the differences.

How to Use SubForms

To demonstate the SubForms feature we will use an example of two forms the ADD_BASKET and the ADD_REQUEST, as mentioned above.

Let’s see how you may create a basket and afterwards how you may add products in this basket, without opening the ADD_REQUEST form.

In the print screen below you may see that we are creating a new Basket. We have assigned a unique ID for the basket (BASKET_ID_FULL), and afterwards we enter some data to all the other fields and then we may save our entry.

sub1

After saving our entry, we are able to view our data and from that view, users have now the ability to view or add new data through the subform function.

sub2a

In the picture above, the subform field is the third in the sequence.

sub2

In the picture above, the subform field is set as the last in the sequence.

By clicking Add you will be the SubForm will open (ADD_REQUEST in this case) for that particular basket as you may see below and you may proceed in creating a new product for that basket.

sub3

Another usability of the SubForms is while revisiting a basket. Then the previous entry will open and you will have the option to add products for that basket. By scrolling at the bottom of that entry you will not be able just to see the save option as usual but also the Add new record option.

sub4

By clicking the Add new record the SubForm will launch in a pop up window where you may create you entry as usual. See the screenshot below.

sub5

When you’ll finish creating your entries using the SubForm, then you click the update button and you will be redirected back to the data view page.

Below is an example of how what you will see when you will make some entries using the subform feature.

sub6