how to sum up the numbers from a group

  • Asked
  • Active
  • Viewed 4307 times
0
1

Hi Open Foris Team, I have a question - Can you please explain to me how to sum up the numbers in the following case: If I have the case like this: 1 1 2 2 2 2 3 3 3 4 5 5 And I want to add one representative of each number group (e.i. 1+2+3+4+5)

Thanks in advance

1

Accepted answer

Hi Beka,
Sorry, you are right, the expression won't work in this case.
We will add an extra custom math:sum function that can be used in this case, it will be available in version 3.21 of Collect (it will be released next week).
Thanks again,
Open Foris Team

1

Accepted answer

Hi Beka,
You can use an expression like this:
sum(idm:distinct-values(list_of_values))
where list_of_values can be provided as a multiple attribute or as an attribute inside a multiple entity, so your final expression can be:
sum(idm:distinct-values(entity_name/attribute_name))

Many thanks,
Open Foris Team

Thank you very much. I tried expression like this: sum(idm:distinct-values(parent()/tree/sum_basal_area1))

And after preview, when I press "tree" Entity, the error message appears.

https://drive.google.com/drive/folders/1FUcehn5Js3LBH3w-gG9876MI-S8Yq4DM?usp=sharing

beka beka

Your answer

Markdown text. Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link, Ctrl+E code, Ctrl+Shift+V paste as plain text. Tab indents list items and code; press Escape, then Tab, to leave the text box.

Insert an image

Say what the image shows, for people who can't see it.

Keyboard shortcuts

Anywhere

?
Show this list
/
Search
g h
Go to the home page
g q
Go to the questions
g t
Go to the tags
g u
Go to the users
a
Ask a question

Lists of questions

j k
Next or previous question
Enter
Open the question

Question pages

j k
Next or previous post

Shortcuts never apply while you type in a text field. Members can turn them off in their preferences.