31 Dec 2018: Thank you to our knowledgeable and friendly forums users for another great year. We are aware of the uptick in spam accounts and are doing our best to ban these at first sight. Thank you for your patience!

Response calculation and rule

Hi OC community

My CRF consists of a repeating group item which includes an item called NOT_GIVEN and is used in a sum calculation. The calculation is added to an item called NOT_GIVEN_COUNT which not in the repeating group, the calculation is func: sum(NOT_GIVEN).

If NOT_GIVEN_COUNT is greater than 0 the user is required to ask another question, item called REASON. The expression for the rule to check if a reason is required is; REASON eq "" and NOT_GIVEN_COUNT ne 0

The issue is the rule is not working how I would envisage, for example. I add two rows and leave NOT_GIVEN in both and press Save. The NOT_GIVEN_COUNT is calculated to 0 and REASON is blank, this should not fail validation. However this fails the validation check. My thoughts are the rule is being executed before the sum calculation is performed, does anyone know if this is true? I have tested the rule in Rule designer and works how I would have expected.

If anyone has any thoughts or suggestions I would be very grateful.

Best wishes
David 


Tagged:

Comments

  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    via Email
    Maybe try adding a condition that the count isn't blank too: and
    NOT_GIVEN_COUNT ne "", or an expression that implies an integer result: and
    NOT_GIVEN_COUNT gt 0
  • dvmurraydvmurray Posts: 14
    Thanks Lindsay, I'll experiment with the rule expression and update you with the results.

    Best wishes
    David
This discussion has been closed.