Skip to content

When survey.data contains a number as a string, and an expression returns the same value as a number, survey response stays the same #9690

Closed
@JaneSjs

Description

@JaneSjs

T22451 - expression calculated at loading time but does not change the survey data
https://surveyjs.answerdesk.io/internal/ticket/details/T22451


View Demo

Usage scenario: an expression field is calculated using a custom function. The custom function produces a numeric result (e.g., 2).
A survey.data is set to some response. The response contains a value for the expression field. The value is a string ("2").
The issue: a form library uses the Helpers.isTwoValueEquals function to check if these two values (2 and "2") are equal. These values are considered equal and the expression field's value is not updated to use the custom function result (2). Instead, the expression field persists the value specified via survey.data ("2").

Suggestion: introduce an option which would additionally check a value type. If types are different, update a question value and use the custom function result.

Metadata

Metadata

Assignees

Labels

user issueAn issue or bug reported by users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions