In this tutorial, we will see how use a field with type “Select” to checks values that are in another tables. For example, we are using two tables:
“states”(that will include the values to be checked) and “city” (that will receive the values that are in states).
First we will see how is organized the table that we will use to receive the information see image that are below:
Try see that we have two fields, that have a relation of “Value x description”. The field stateid have the acronyms each state, the field statename have the description each state.
Now we will see the form that was created in table “city”, see image that are below:
How can see above, the table “city” have only three fields, cityname, stateid and statename where the field stateid will be the field used to receive the values that are in table “states”, with this way we can restrict the insert only states registered.
So, we will change the type of the data of the field stateid to “select”, accessing the left menu “Field -> stateid”:
And for finish, it's only create a SQL Select Statement in option “Lookup Settings”, in this example we are using the option Lookup Method “Automatic”, where the field stateid will the value to be insert in the database when the rows will be choose, and the field StateName will used only how description. Below have the statement generate that was used for this tutorial:
To finish this process you will have a field with the type select that will show the values of the field description of the table “states”, and will insert in the table “city” the value select of the field stateid.