This functionality is needed because sometimes you need to add a submission to a device. The use cases are...
Currently, the only way to add instances is to copy the /odk folder with the relevant databases. This overwrites any other existing ODK data. My proposed feature is more about being able to incrementally add, and eventually remove submissions.
This probably not gonna fly easily.
tl;dr:
The instance record looks like this:
2|sample||true|/storage/sdcard/odk/instances/sample_2017-02-27_23-29-21/sample_2017-02-27_23-29-21.xml|sample||submitted|1488257479383|Sent on Mon, Feb 27, 2017 at 23:51|
The instance xml looks like this:
<?xml version='1.0' ?>
<sample_xlsform id="sample">
... data stuff goes here
<metadata_note />
<start>2017-02-27T23:29:21.843-05</start>
<start_test_output />
<end>2017-02-27T23:30:38.245-05</end>
<end_test_output />
<today>2017-02-27</today>
<today_test_output />
<deviceid>6395771f8f6c42f8</deviceid>
<deviceid_test_output />
<simserial>89014103211118510720</simserial>
<simserial_test_output />
<phonenumber>15555215554</phonenumber>
<phonenumber_test_output />
<meta>
<instanceID>uuid:3a6b9f77-40b6-46ca-a687-f23eaec77d2f</instanceID>
</meta>
</sample_xlsform>
One approach that can be done I think:
I think this should be a manually triggered process instead of automatic one.
@yanokwa Can you please describe a use case in your initial issue description?
This is simple shell script to duplicate one of your instance if the instances folder. This script will take the folder name of one instance and duplicate it 100 times and rename the xml file to match the folder name.
#!/bin/bash
for ((i = 1; i <= 100; i++)); do
cp -R $1 $1_${i}
mv $1_${i}/$1.xml $1_${i}/$1_${i}.xml
done
To run it, you'll need to be in an instances folder, then ./script.sh single_instance_folder_name
Most helpful comment
This is simple shell script to duplicate one of your instance if the instances folder. This script will take the folder name of one instance and duplicate it 100 times and rename the xml file to match the folder name.
To run it, you'll need to be in an instances folder, then
./script.sh single_instance_folder_name