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
2146
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

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

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

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
2146
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

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

question asked: 21 Apr '16, 12:05

question was seen: 4,418 times

last updated: 22 Apr '16, 15:59