surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.21k stars 815 forks source link

`SurveyModel`'s `runExpression()` method always returns `false` instead of the actual result when the expression includes asynchronous operations #8858

Closed JaneSjs closed 1 month ago

JaneSjs commented 1 month ago

T20012 - Running expression with displayValue is returning false https://surveyjs.answerdesk.io/internal/ticket/details/T20012


The survey.runExpression function always returns false, however, according to the documentation, it is expected to return the expression evaluation result.

https://github.com/surveyjs/survey-library/blob/56f0eec24fc10b0a82875cef9dbda2f25b44eb62/packages/survey-core/src/survey.ts#L2338

View Demo


The same result is returned by the following code:

var expressionRunner = new Survey.ExpressionRunner();
expressionRunner.expression = "displayValue('question1')";
var values = survey.getFilteredValues();  
var properties = survey.getFilteredProperties();
var result = expressionRunner.run(values, properties);