Let's say I have a repeating group called FruitBasket and an element called Apples under it. I would like to set up a data validation where if the sum of all apples in all the repeating sections > 10, then flag.
I tried setting up the following expression:
sum(/my:FruitBasket/my:Apples) > 10
However, it flags only on the input that caused it to go over, not on all of them. Also, even if you go to a repeating section w/out the flag and lower the apple count so it is less than 10, the flag still remains on that flagged control until you change its value.
Oddly, I ran into this problem before and I was able to get it to work somehow. I tried several approaches to accomplish this.
1) I tried sum(xdMath:Nz(my:FruitBasket/my:Apples)) > 10. Same results. I didn't expect any major difference anyway.
2) Placed in another element called ZeroValue under FruitBasket. I then used sum(/my:FruitBasket/my:Apples) + sum(/my:FruitBasket/my:ZeroVale) > 10. Odd as it sounds, this did work in the past in another form. Not working now.
3) Added another element called AppleTotal. I then placed in a rule under Apples where it set AppleTotal = sum(/my:FruitBasket/my:Apples). Apples then got a data validation that flagged if AppleTotal > 10. Same results.
I tried combinations of 1,2 and 3. Kinda frustrated it works easily with one form and not the other. I tried doing a search in InfoPathdev but no similar issues.
Any advise would be helpful as I assumed this was a simple setup. Flag on all if sum exceeds a value.
Thanks!
Don't grow old regretting the things you didn't do.