OF Collect version 3.9.13:
I created a new unique ID calculated from an expression from the attribute tree ID and stem ID and I'd like to use the new calculated ID for checking the uniqueness during data entry.
The options "Is key?" and "Strict" in Survey Designer are disabled for calculated attributes. How can I prevent duplicates during data entry and cleansing? Kind regards.

asked 21 Apr '16, 12:05

hfuchs's gravatar image

hfuchs
2116
accept rate: 0%


Hi,
Nowadays you cannot define a calculated attribute as identifier of an entity.

You can define both tree_id and stem_id as the key identifiers for the tree entity.

Please try it and let us know.
Thanks,
Open Foris Team

permanent link

answered 22 Apr '16, 10:47

OF%20Collect's gravatar image

OF Collect ♦♦
2.6k8
accept rate: 21%

edited 22 Apr '16, 13:31

Dear ricci and Open Foris Team,
the first solution was already smart but this one is very elegant and works perfectly. Grazie mille!

permanent link

answered 22 Apr '16, 14:14

hfuchs's gravatar image

hfuchs
2116
accept rate: 0%

Hi,
If you need to define a uniqueness check for one (or more) "primary key" attribute, just define it as Key.
If you already defined an attribute as the (primary) key attribute and you want to check the uniqueness of another attribute, you can create a new Uniqueness check for that attribute and write an expression that will return the list of values that must be unique (e.g. suppose that you want to assign a tree_name to every tree and this name must be unique, you can define a Uniqueness check with an expression like: parent()/tree/tree_name. The check will verify that the value you insert in tree_name is unique considering all the tree entities.

If you want to check the uniqueness of more than one attribute, for example attribute1 and attribute2 you cannot use the Uniqueness check (nowadays...) but you have to define a Custom check using an expression like this:

count(parent()/tree[attribute1 = $this/parent()/attribute1 and attribute2 = $this/parent()/attribute2]) = 1

This expression looks a bit tricky but it's just saying that the number of trees having attribute1 and attribute2 equal to the current one must be equal to 1.

Thanks a lot,
Open Foris Team

permanent link

answered 22 Apr '16, 15:59

OF%20Collect's gravatar image

OF Collect ♦♦
2.6k8
accept rate: 21%

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:

×350

question asked: 21 Apr '16, 12:05

question was seen: 2,495 times

last updated: 22 Apr '16, 15:59