Addition operand in math formula results in concatenation rather than sum for numeric
values. I am trying to sum 4 previous fields to confirm that they add up
to 1.0. The following formula ${EC} + ${FLC} + ${OWC} + ${ShC} results in a
concatenation (0.40.30.20.1), rather than a sum (1.0) of the fields. The other
operands all work correctly. In the Excel spreadsheet the name cells for the
select_one field (e.g., PropCover) are defined as numeric and the type for the
recipient cell (TotalCover) is decimal. When I use the form with this formula
in ODK Collector the addition operand works correctly. Am I missing something?
Thanks.
Solved! Go to Solution.
Hi Edmund. You need to cast the fields as integers for them to sum correctly and not just concatenate. Your formula should look as follows: int(${EC}) + int(${FLC}) + int(${OWC}) + int(${ShC})
Hope that helps. Phil.
Hi Edmund. You need to cast the fields as integers for them to sum correctly and not just concatenate. Your formula should look as follows: int(${EC}) + int(${FLC}) + int(${OWC}) + int(${ShC})
Hope that helps. Phil.
Hi Phil,
How would you cast decimals? I tried dec and decimal, but got error messages. Thanks.
Bob
Cross referencing response: Addition operand in Survey123 XLS form