EDITED to use last-saved
instead of last
as the prefix.
How have the latest ideas aged through various showers/sleeps/brain marination sessions?
Here is what I think the latest proposal looks like:
- If the contents of the
default
column are not a literal value, the expression is passed through to thevalue
attribute of thesetvalue
action (see documentation) triggered on first load (using theodk-instance-first-load
event). Literal values get treated the same way they do now. - Introduce new syntax to refer to a question in the last instance:
${last-saved#<question_name>}
- If an XLSForm definition uses this construct,
<instance id="__last-saved" src="jr://instance/last-saved" />
will be added to the XForm -
${last-saved#<question_name>}
will expand toinstance('__last-saved')/data/question_name
(with additional group/repeat levels as needed -- same as with the${<question_name>}
construct).
- If an XLSForm definition uses this construct,
survey | type | name | label | default |
---|---|---|---|---|
text | street | Street | ${last-saved#street} | |
date | disaster_date | Disaster date | today() | |
integer | patient_count | How many patients have you seen today? | if(${last-saved#patient_count} == '', 0, ${last-saved#patient_count} + 1) | |
select_one yes_no | same_street | Are you still on ${last-saved#street}? |
This:
- Avoids introducing a new column as requested by @adam.butler
- Avoids underscores in user-facing syntax as requested by @yanokwa
- Gets at the pseudo-class analogy @tomsmyth was suggesting (hopefully the
#
doesn't bother you too much) - Can be generalized to refer to other standard secondary instances we may define in the future as @Tino_Kreutzer and @adam.butler have requested (
${session#<session property>
} comes to mind as discussed with @Xiphware and @martijnr at ODK XForms spec proposal: introduce a virtual instance for metadata)