Sum different attributes

  • Asked
  • Active
  • Viewed 5013 times
0

Hi colleagues,

I would like your help on the above.

I want to sum different attributes (number attributes) e.g. total cover_1, total cover_2, in my survey, in order afterwards to create a validation rule (e.g. total cover (i.e. total cover_1+total cover_2) <=100%). Could you advice how this summing can be done?

Those attributes (total cover_1, total cover_2) are found in different tabs of the survey, and are the result of the sum of other attributes as part of multiple entities (1/N). Just to note that the sum of the respective attributes (e.g. total cover_1) has been done successfully.

Thanks in advance, itzam

0

Accepted answer

Hi Itzam,
You can of course use other calculated attributes as source of a calculated attribute, so in general there are no problems.
Can you give us some more information about the structure of your survey? E.g. are total_cover_1 and total_cover_2 in the same level as total_cover? Are they inside some other single or multiple entities?
Many thanks,
Open Foris Team

0

Accepted answer

Hi again and thanks for your prompt response,

Yes of course I can give you more info (I will try to explain as detailed as possible).

Total_cover has not been developed;

Total_cover_1 and total_cover_2 are in the same level, having the plot as a root (i.e. plot/total_cover_1, plot/total_cover_2), although appearing in different tabs. Total_cover_1, and total_cover_2 calculate the sum(using the sum function) of other attributes being part of multiple entities (1/N) (e.g. element_type_1 the total_cover_1, and element_type 2 the total_cover_2). Element_type_1 and 2 are also in the same level.

I hope this helped,

Many thanks again, itzam

0

Accepted answer

Hi Itzam,
Then just define total_cover using an expression like total_cover_1 + total_cover_2.
Collect will first calculate the result of total_cover_1 and total_cover_2, then it will sum up them to calculate total_cover.
Please try it and let us know, many thanks.
Open Foris Team

0

Accepted answer

Yes that worked perfectly.

Thanks a lot,

itzam

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.