Tip: Interface patterns give you an opportunity to explore different interface designs. Be sure to check out How to Adapt a Pattern for Your Application.
When using a dropdown to select values from the database, or generally from an array of CDT values, configure it to save the entire CDT value rather than just a single field.
This scenario demonstrates:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
a!localVariables(
local!foodTypes: {
a!map( id: 1, name: "Fruits" ),
a!map( id: 2, name: "Vegetables" )
},
local!selectedFoodType,
a!formLayout(
label: "Example: Dropdown with CDT",
contents: {
a!dropdownField(
label: "Food Type",
instructions: "Value saved: " & local!selectedFoodType,
choiceLabels: index(local!foodTypes, "name", null),
placeholder: "--- Select Food Type ---",
/* choiceValues gets the CDT/dictionary rather than the ids */
choiceValues: local!foodTypes,
value: local!selectedFoodType,
saveInto: local!selectedFoodType
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidget(
label: "Submit",
submit: true
)
)
)
)
local!foodTypes
with a CDT array that is the result of a!queryEntity()
or a!queryRecordType()
. These functions allow you to retrieve only the fields that you need to configure your dropdown.Configure a Dropdown Field to Save a CDT