Skip to content

Instantly share code, notes, and snippets.

@MartijnR
Created July 25, 2019 21:22
Show Gist options
  • Save MartijnR/ddd1a4d69cd6767205c71160e7ee91ac to your computer and use it in GitHub Desktop.
Save MartijnR/ddd1a4d69cd6767205c71160e7ee91ac to your computer and use it in GitHub Desktop.
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>date-issue-ff-fix-pad</h:title>
<model>
<instance>
<date-issue-ff-fix-pad id="date-issue-ff-fix-pad">
<REFDATE>
<OBS_END/>
<DAY/>
<MONTH/>
<YEAR/>
<OBS_START/>
<MONTH7/>
<YEAR7/>
<BEGIN7/>
</REFDATE>
<meta>
<instanceID/>
</meta>
</date-issue-ff-fix-pad>
</instance>
<bind nodeset="/date-issue-ff-fix-pad/REFDATE/OBS_END" type="date"/>
<bind calculate="substr( /date-issue-ff-fix-pad/REFDATE/OBS_END , 8, 10)" nodeset="/date-issue-ff-fix-pad/REFDATE/DAY" readonly="true()" type="string"/>
<bind calculate="substr( /date-issue-ff-fix-pad/REFDATE/OBS_END , 5, 7)" nodeset="/date-issue-ff-fix-pad/REFDATE/MONTH" readonly="true()" type="string"/>
<bind calculate="substr( /date-issue-ff-fix-pad/REFDATE/OBS_END , 0, 4)" nodeset="/date-issue-ff-fix-pad/REFDATE/YEAR" readonly="true()" type="string"/>
<bind calculate="concat( /date-issue-ff-fix-pad/REFDATE/YEAR - 2,'-', /date-issue-ff-fix-pad/REFDATE/MONTH ,'-', /date-issue-ff-fix-pad/REFDATE/DAY )" nodeset="/date-issue-ff-fix-pad/REFDATE/OBS_START" readonly="true()" type="string"/>
<bind calculate="if( /date-issue-ff-fix-pad/REFDATE/MONTH &lt;= 7, /date-issue-ff-fix-pad/REFDATE/MONTH +5, /date-issue-ff-fix-pad/REFDATE/MONTH - 7 )" nodeset="/date-issue-ff-fix-pad/REFDATE/MONTH7" readonly="true()" type="string"/>
<bind calculate="if( /date-issue-ff-fix-pad/REFDATE/MONTH &lt;= 7, /date-issue-ff-fix-pad/REFDATE/YEAR - 1, /date-issue-ff-fix-pad/REFDATE/YEAR )" nodeset="/date-issue-ff-fix-pad/REFDATE/YEAR7" readonly="true()" type="string"/>
<bind calculate="concat( /date-issue-ff-fix-pad/REFDATE/YEAR7 ,'-',pad2( /date-issue-ff-fix-pad/REFDATE/MONTH7 ),'-', /date-issue-ff-fix-pad/REFDATE/DAY )" nodeset="/date-issue-ff-fix-pad/REFDATE/BEGIN7" readonly="true()" type="date"/>
<bind calculate="concat('uuid:', uuid())" nodeset="/date-issue-ff-fix-pad/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
<h:body>
<group ref="/date-issue-ff-fix-pad/REFDATE">
<label>#### Reference Dates</label>
<input ref="/date-issue-ff-fix-pad/REFDATE/OBS_END">
<label>End of month 24 (end of observation period)</label>
</input>
<input ref="/date-issue-ff-fix-pad/REFDATE/DAY">
<label>Day</label>
</input>
<input ref="/date-issue-ff-fix-pad/REFDATE/MONTH">
<label>Month</label>
</input>
<input ref="/date-issue-ff-fix-pad/REFDATE/YEAR">
<label>Year</label>
</input>
<input ref="/date-issue-ff-fix-pad/REFDATE/OBS_START">
<label>Beginning of month 1 (start of observation period)</label>
</input>
<input ref="/date-issue-ff-fix-pad/REFDATE/MONTH7">
<label>Beginning of month 7 (month)</label>
</input>
<input ref="/date-issue-ff-fix-pad/REFDATE/YEAR7">
<label>Beginning of month 7 (year)</label>
</input>
<input ref="/date-issue-ff-fix-pad/REFDATE/BEGIN7">
<label>Beginning of month 7 (date)</label>
</input>
</group>
</h:body>
</h:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment