Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce survey value changed on adding new panel in dynamic panel with complex calculations #7005

Closed
andrewtelnov opened this issue Sep 24, 2023 · 0 comments · Fixed by #7006
Assignees
Milestone

Comments

@andrewtelnov
Copy link
Member

The following JSON will produce call survey setValue function 2 times on adding the first panel, 4 times on adding the second panel and so on:

{
    questions: [
      {
        name: "question1",
        type: "paneldynamic",
        templateElements: [
          { type: "expression", name: "q5", expression: "{panel.q4} + {panel.q3}" },
          { type: "text", name: "q1", defaultValue: 1 },
          { type: "text", name: "q2", defaultValue: 2 },
          { type: "text", name: "q3", defaultValueExpression: "{panel.q1} + {panel.q2}" },
          { type: "text", name: "q4", defaultValueExpression: "{val1}" }
        ]
      }
    ],
  }

The reason, because "q5" that will be caclulated at first depends on questions that calcualted later. As result q5 in the panel will be caclulated correctly after a new panel will be added, triggers by changing the dynamic panel "question1" value.
It will be better for performance, if we caclulate "q5" correctly at the first time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants