I swear I think about these proposals deeply before publishing them!
Writing out a description of the feature and its usage here got me disliking the yes/no column idea. I think it's too limiting not to be able to easily do transformations on the last saved value. I now am preferring the dynamic_default
column with the addition of some way to hide the complexity of instance('__last-saved')/data/a
.
This proposal includes two parts:
- a new
dynamic_default
column. The contents are passed through to thevalue
attribute of thesetvalue
action (see documentation) triggered on first load. - a new transformation to hide
instance('__last-saved')/data/a
. In the example below, I suggest a__last
suffix. For example, just as${a}
expands to/data/a
,${a__last}
would expand toinstance('__last-saved')/data/a
I didn't explicitly mention this in the prior proposal but either way, pyxform would add the proper XML to define the __last-saved
instance if one of these dynamic defaults is used.
survey | type | name | label | dynamic_default |
---|---|---|---|---|
text | street | Street | ${street__last} | |
date | disaster_date | Disaster date | today() | |
integer | patient_count | How many patients have you seen today? | if(${patient_count__last} == '', 0, ${patient_count__last} + 1 | |
select_one yes_no | same_street | Are you still on ${street__last}? |
This column would provide value beyond just making previously-entered values available. For example, form designers have been wanting to set a date to default to today's date for some time.