Hello again,
After having implemented the workaround described above it appears to be working for the first but not for the following subplot entities.
Each plot is subdivided into 8 entities (sub-plots). Each sub-plot contains the following three attributes relevant to the question:
- taxon: taxa from species list
- taxon.code: taxon/@code as integer
- taxon.already.sampled: text attribute calculated based on the following expression:
string(count(parent()/subplot1[taxon.code = $context/taxon.code]) > 1)
In the first entity (subplot 1), the field taxon.already.sampled correctly recognises when a taxon has already been sampled (true) and when it has not yet been sampled (false).
The problem evolves in the second (and the following) subplot. We would like OF to recognise if a taxon had already been sampled in any subplot (not only the current one). Thus, I added a second term to incorporate the former entities in the attribute taxon.already.sampled, resulting in the following expression:
string(count(parent()/subplot1[taxon.code = $context/taxon.code]) > 1) or string(count(parent()/subplot2[taxon.code = $context/taxon.code]) > 1)
This code, though, does not work correctly. The field taxon.already.sampled remains ‘true’ for all newly added taxa, regardless of whether or not they had already been sampled within the current or a former subplot. The validation rules based on this attribute are thus not correctly warning the user if a specimen needs to be collected or not.
It seems that the expression in subplot2 fails to extract from subplot1.
Which expression should I use in the taxon.already.sampled field to check for correspondences within all subplot entities?
Thank you very much in advance,
Jan