This scenario demonstrates:
- How to disable the automatic recalculation of a variable's default value once a user has edited that variable directly.
ExpressionCopy link to clipboard
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
a!localVariables(
local!startDate: today(),
local!endDateEdited: false,
local!endDate: a!refreshVariable(
value: local!startDate + 7,
refreshOnReferencedVarChange: not(local!endDateEdited)
),
{
a!dateField(
label: "Start Date",
value: local!startDate,
saveInto: local!startDate
),
a!dateField(
label: "End Date",
value: local!endDate,
saveInto: {
local!endDate,
a!save(local!endDateEdited, true)
}
)
}
)
Copy
Test it outCopy link to clipboard
- Select a new value for Start Date. Notice that
local!endDate
is updated based on the new value forlocal!startDate
. - Select a value for End Date
- Select a new value for Start Date. Notice that
local!endDate
retains the user's input and does not automatically update.
FeedbackCopy link to clipboard
Was this page helpful?