For drop-downs with fixed values, you set the initial selection by choosing a value in Calcapp Creator. Simple and direct.
But when drop-down values are determined using a formula, those values aren’t known until the app runs. The drop-down in Creator is disabled because there’s nothing to select from yet.
Instead, you set the initial value using a formula. Select InitialValue from the property drop-down in the inspector:
Example formulas
Select a specific value
If you know that 2 is always part of the available values, use this formula:
Select the first value
If you don’t know what values will be available and want the first one selected:
The INDEX function selects the
first value from Values.
Item
references the drop-down field that the InitialValue property belongs
to.
Select the last value
SIZE returns the number of values, which INDEX uses to select the last one.
Select the middle value
Dynamic re-evaluation
Traditionally, a field’s InitialValue property is only read when navigating to the screen containing that field.
For formula-driven drop-downs, InitialValue is now re-evaluated whenever the available values change. This handles an important scenario: what happens when a user’s selection becomes invalid?
Consider two drop-downs: one for country, another for province. When the user changes countries, the province list updates. But if they had already selected a province, that selection likely becomes invalid since different countries rarely share province names.
Calcapp automatically re-evaluates InitialValue in this situation. If
you’ve used a formula like INDEX(Item.Values, 1)
,
the first province in the new list gets selected automatically,
keeping the app in a valid state.