In this chapter we will use field mappings to populate more than one field from a drop-down. Our goal to populate the country name and associated country code from a single drop-down in the contacts app:
Update your contacts app to do the same. To recap the steps in the video:
- Add a new field
CountryCode
to the streamCountry List
- Add this new field to the grid view and edit form in the app to maintain the list of countries
- Go into App Mode, and add codes for all the countries you have added so far
- Go back into Design Mode, and open the configuration form for the stream Country List
- Create a new view to provide the drop down list:
- Call this
Country Select
- Make this a Grid view
- Add the attribute
CountryList
- Call this
- Add new fields
CountryName
andCountryCode
for contacts:- Add both to the stream
Contacts
- Add both to the grid view in the
Contacts
app - Add both to the edit form in the
Contacts
app
- Add both to the stream
- Convert the
Country Name
field in theContacts
edit form to a drop-down:- From the stream
Country List
, drag the viewCountry Select
onto the fieldCountry Name
- You will be asked if you want to convert this field to a drop-down - confirm this
- From the stream
- Go into App Mode to confirm that
Country Name
in theContacts
app is now a drop-down - Add the country code into the drop down:
- From the stream
Country List
, edit the viewCountry Select
- Add the attribute
CountryCode
- Make this attribute hidden, so that it does not also show in the drop down
- From the stream
- Add a mapping to populate
Country Code
from theCountry Name
drop-down:- Open the layout for the
Contacts
edit form (this is calledContact Details
) - Find the field
CountryName
- Add a mapping:
- Form Field:
CountryCode
- Drop Down Field:
CountryCode
- Form Field:
- Open the layout for the
Go into App Mode, and enter some new contact details. You will see that when you select the country from Country Name
, the Country Code
is populated automatically.
Next chapter: TODO