Validating how many times a question value appears across panels #10824
-
|
Hi, Is there a built-in way in SurveyJS to validate how many times a specific question value appears across all panels in a dynamic panel (or similar repeating structure)? For example, given a dynamic panel with the same question repeated in each panel:
I know For example a validation expression like this:
I’m mainly trying to understand whether this kind of cross-panel counting is supported by expressions. Any guidance on recommended approaches would be appreciated. Many thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi,
How
|
| Approach | Use when |
|---|---|
keyName on the Dynamic Panel |
Each panel must have a unique value for one template question (duplicates are blocked entirely). |
countInArray + expression validator |
A value may repeat, but only up to N times (or you need a minimum count). |
Learn More
Beta Was this translation helpful? Give feedback.
Hi,
Use an expression validator on the Dynamic Panel together with the built-in
countInArrayfunction.countInArraycounts items in a Dynamic Panel, Dynamic Matrix, or Multi-Select Matrix array where a specified field matches optional filter conditions. Attach a validator to the panel dynamic question (not to the inner template question) so the rule runs against all panels at once.How
countInArrayworks{employees}).