We would like to get partially pre-filled forms on to devices, so a user
can see and complete them in Collect.
There are a number of requirements for this, including inspectors,
healthcare visitors, etc where information that is pertinent to the tasks
would be already available on the forms.
Looking at the structure of the ODK folders and database, it looks possible
to add a new form instance (that contained pre-filled data) to the instance
folder and to then add a reference to this in the instance table. We were
thinking of perhaps writing an application that would add a new data row to
the SqLite Instance table, and also create a folder and instance xml file
in the ODK folder on the device.
Is this possible to do or is there a better way to get pre-filled forms on
to the devices?
(1) register a form definition with the ODK Collect content provider:
FormsProvider
(2) register a form instance with the ODK Collect content provider:
InstanceProvider
(3) launch ODK Collect specifying the Uri of the form instance as returned
by the InstanceProvider. e.g.,
Uri insertUri
Intent intent = new Intent();
intent.setComponent(new ComponentName("org.odk.collect.android",
"org.odk.collect.android.activities.FormEntryActivity"));
intent.setAction(Intent.ACTION_EDIT);
intent.setData(insertUri);
startActivityForResult(intent);
If you create a form definition using Build or XLSForm, then (1) is
accomplished by downloading that form to the phone and opening Collect's
Fill-Blank-Form dialog (so that it is scanned and recorded as available).
You can also manually insert a form using the content provider, but you
will need to do some XML (javarosa) parsing or know a priori the needed
fields.
ยทยทยท
On Tue, Dec 18, 2012 at 10:15 AM, Paul wrote:
Hi,
We would like to get partially pre-filled forms on to devices, so a user
can see and complete them in Collect.
There are a number of requirements for this, including inspectors,
healthcare visitors, etc where information that is pertinent to the tasks
would be already available on the forms.
Looking at the structure of the ODK folders and database, it looks
possible to add a new form instance (that contained pre-filled data) to the
instance folder and to then add a reference to this in the instance
table. We were thinking of perhaps writing an application that would add a
new data row to the SqLite Instance table, and also create a folder and
instance xml file in the ODK folder on the device.
Is this possible to do or is there a better way to get pre-filled forms on
to the devices?