Hello all,

we have the following problem. We designed, published a Collect survey and imported it into Collect Mobile. Up to here everything works as it should, no problems. I can add records, delete them, etc.

I have then added some sample data using the Collect data management, which can be exported using the Collect interface into different formats, including SQL. Is there a way to upload this data to Collect Mobile running on a tablet? (e.g. to replace/update file or nodes in Android/data/org.openforis.collect/files/surveys/oursurvey).

If not, can you perhaps explain the structure of where data (I assume file "nodes") is saved on the tablet by Collect Mobile? I have a working knowledge of SQL, so inserting existing data should not be too big of a challenge, if I knew how this file is structured. If this was possible, then existing data could be uploaded to the tablet and would expand the reach of Open Foris applications significantly.

Kind regards, Luka

asked 24 Jul '23, 17:09

luka's gravatar image

luka
212
accept rate: 0%


Dear Luka,
As you have understood correctly, the file containing the data in Collect Mobile is "nodes", that is a SQLite database.
Updating that file outside from Collect Mobile won't be easy, but I will try to explain the structure of it.
The table you will have to fill is ofc_view_model and these are the most relevant columns:

  • id: internal identifier (a progressive number)
  • relevant: 0 = not relevant, 1 = relevant (evaluated at runtime, according to the rule defined in the Survey Designer in Collect)
  • status: OK - no errors in the attribute/entity/record, VALIDATION_ERROR - validation error found, EMPTY - the attribute/entity/record is empty
  • parent_id: parent node internal id (the value of the ID column corresponding to the parent node); the parent node is the "entity" that contains the attribute or the entity defined in the row; the value can be "null" only for the root entity;
  • parent_entity_id: equal to the column above but it has a value only when the node is a multiple attribute or a multiple entity
  • definition_id: internal id of the "definition¨ of the node, as it is in the file idml.xml of the survey export generated by Collect;
  • survey_id: it's always 1, because every survey has it's own nodes db;
  • record_id: internal identifier of the record; every record will have a row in the nodes table that identifies it, with a null value in the parent_id column;
  • record_collection_name: name of the root entity defined in the survey designer (e.g. cluster); it is filled only when the row corresponds to a record;
  • record_key_attribute: it contains "1" only if the node corresponds to a key attribute of the record, 0 otherwise;
  • node_type: type of node, following the type defined in the survey designer. 1=record (identifies the row corresponding to the entire record), 2=entity, 4=entity collection (list of entities), 5=attribute collection, 6=code, 7=coordinate, 8=date, 9=numeric (double), 12=file, 13=numeric (integer), 15=taxon, 16=text, 17=time
  • val_*: the value columns (with val_ as prefix) are filled in depending on the type of attribute (e.g. val_text is for text attributes, val_date for date attriutes etc.)
  • created_on and modified_on: timestamp with the creation and modified dates;

Hoping this is clear enough, we wish you the best luck updating this table by yourself!
Let us know if you need further assistance, many thanks,
Open Foris Team

permanent link

answered 25 Jul '23, 15:04

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
4.7k19
accept rate: 20%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×493
×170

question asked: 24 Jul '23, 17:09

question was seen: 372 times

last updated: 25 Jul '23, 15:04