I have a code attribute with codes 1,2,...,10 in a multiple entity. When the user adds "n" entities to the form, the sum of the code values from 1 to "n" have to add up to 10.

I'd like to check the sum of these code values in a separate attribute. Since codes in code lists are strings, the values should be converted to numbers to be able to sum them. So I figured this should work:

Custom error check, expression: sum(number(parent()/stand/share)) = 10

However I get an error in the preview window: [RPC Fault faultString="Invalid argument type for 'sum': java.lang.Double"...

Is it possible to convert a set of strings to numbers? How can I do this? I would like to keep code list instead of a numeric attribute, if it's possible.

Thanks for your help!

asked 22 Oct '14, 09:07

Andras's gravatar image

accept rate: 0%

Hi Andras,

you can solve this issue by adding a new hidden calculated attribute that will transform your share code value into a number, for example share_num with an expression like number(share) and then you can use that attribute in the custom check expression, that will become something like sum(parent()/stand/share_num) = 10.


permanent link

answered 22 Oct '14, 11:51

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

Stefano (OF) ♦♦
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



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:


question asked: 22 Oct '14, 09:07

question was seen: 3,981 times

last updated: 22 Oct '14, 11:51