Working with multiple entities or CSV in a form

1. What is the issue? Please be detailed.

I am trying to use the entity feature in Central for a tree survey.

The idea is to have three forms:

  1. Form 1 is to collect the tree details - species, location, measurements
  2. Form 2 is to collect details of Potentail Roost features (PRFs), which there can be multiple on one tree
  3. Form 3 is to collect information regarding the internal part of the PRF and whether any wildlife is living inside.

The reason for the three-form approach is that a PRF can either be accessed from ground level (i.e. if it is low enough) or by climbing the tree. Typically, data is collected using a stage approach: stage 1 is a ground-based assessment that collects data regarding the tree and any PRF contained within it. This will include checking the internal area of the feature if it is low enough. Stage 2 is an aerial assessment to check the internal areas of all features and check if anything is living inside, and Stage 3 is for additional/repeat ( up to 14) aerial assessments.

I have tried to do this using two forms with repeats, but entities do not currently support repeats. So each form is to collect data for one item (or entity) i.e. one tree, one PRF which looks up the tree and then the final form to record information regarding the internal area and wildlife or changes in wildlife.

I do not know how to approach pulling the data for both the tree and PRF information collected in Form 1 and Form 2 into Form 3. I have some experience with expressions, but I have no idea how to approach this. I can look the tree up using the same approach as form two but not sure how to pull the information regarding the PRFs.

I assume that I would try to pull the information using the an ID but have no idea now to do this.

I have try to do this in form 3 but getting the following error from form 3

The XLSForm could not be converted: ODK Validate Errors:

XForm is invalid. See above for the errors.
: Cycle detected in form's relevant and calculation logic!
The following nodes are likely involved in the loop:
${label}
${instanceName}
${PRF_ID}

The following files failed validation:
${BTHK-form3}.xml

Result: Invalid

I have attached the last two forms here

BTHK-2.xlsx (33.0 KB)
BTHK-form3.xlsx (33.5 KB)

Any help would be greatly received.

Cheers Paul

This line (form 3) looks a bit suspicious:

integer PRF_ID PRF_ID instance('PRF')/root/item[name=${PRF_ID}]/PRF_ID

I think the PRF entity label that you created via form 2 is not unique, perhaps you can use something like Tree_PRF_ID as label.

After you make the change on PRF label:
In form 3, line 9 for PRF_ID,
calculate instance('PRF')/root/item[name=${PRF}]/PRF_ID should return value.

1 Like

@chun_hing_yap Thank you for your help.

That got rid of the error message, and the form is going through central fine now. Thank you.

However, the data for the PRF entity is not filtered by the selected tree ( it shows all PRF for all trees, not the PRFs for Tree 1 when selected, for example. I have tried using a choice filter, but this does not show any PRFs

Do you know how to fix this?

BTHK-Form3.xlsx (33.5 KB)

BTHK-Form3 with CF.xlsx (33.5 KB)

You need to use select _one_from_file and
Tree_ID = ${} as choice filter.