1
1

Dear all, Special case: I like to collect general information on the status of tree species I found on a plot. Imagine, I have species x, y and z in my tree table and like to add general information on e.g. health (but not for every single tree, rather per species on plot level). Therefore I like to add a table on the plot level. The choice of species in this table should be limited to those I found on the plot (in the tree table). I would need a "dynamic" code list, where I can select from all species that were found on this specific plot (in my case the information is even needed per layer and species). I hope this question is understandable...

asked 13 Feb '18, 09:40

Fehrmann's gravatar image

Fehrmann
7731532
accept rate: 0%


Dear Open Foris Team,

what a beautiful solution! It's working fine and does exactly what I need. Thank you so much!

permanent link

answered 14 Feb '18, 14:39

Fehrmann's gravatar image

Fehrmann
7731532
accept rate: 0%

Dear Lutz,
We don't support such a dynamic table nowadays... but... you can try to solve this issue with a workaround using the default values.
First of all, please update Collect to the latest version (3.20.18) and follow these steps:

  • define a calculated numeric (integer) attribute at the same level of the tree entity to calculate the number of distinct tree species and call it for example distinct_species_count
  • in the calculated value expression write this: idm:count-distinct(tree/species) (where species is the name of your Taxon attribute)
  • define a multiple entity at the plot level
  • define a key attribute of type Taxon inside the new multiple entity
  • in the default value box, add a new default value
  • in the Apply when field write: parent()/count_distinct_species >= idm:position($context)
  • in the Expression field write: idm:distinct-values(parent()/tree/species)[idm:position($context)]
  • in the Checks (Validation Rules) box, define a new Custom check to ensure that the inserted species is among the ones defined for the trees
  • write this in the Expression: count(parent()/tree[species=$this]) > 0
  • write a custom error message that indicates: Species has not been specified for any tree

Now, when you have already defined a list of trees, whenever you add a new row inside the newly defined entity, the value of the Species field will be automatically populated with the species defined in the tree table.

Please try this solution and let us know if it fits your needs.

Many thanks,
Open Foris Team

permanent link

answered 14 Feb '18, 10:19

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

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

A follow up question: how to deal with empty fields? For some trees species is not entered (e.g. dead trees), but the idm:position($context) is not considering this. It works fine in Collect Mobile, but when I open the plot in Collect, my table is shifted and rows are mixed. Is there a way to avoid later re-calculation of fields when I open them in Collect?

(20 Feb '18, 16:20) Fehrmann Fehrmann's gravatar image

Hi Lutz,
The default value applied is not re-calculated when you re-open a record, it's used only to assign a value the first time you create an "entity".
You can try to filter the trees with a specified value for species. The expressions will be:
- idm:count-distinct(tree[not(idm:blank(species))]/species)
- idm:distinct-values(parent()/tree[not(idm:blank(species))]/species)[idm:position($context)]
By the way, in the next version of Collect we will include only not empty values in the distinct-values function... but try to see if these expressions will solve your problem.

(21 Feb '18, 10:22) Stefano (OF) ♦♦ Stefano%20%28OF%29's gravatar image
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

question asked: 13 Feb '18, 09:40

question was seen: 2,596 times

last updated: 21 Feb '18, 10:34