Hi, 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 |
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. Thanks! answered 22 Oct '14, 11:51 Stefano (OF) ♦♦ |