survey-library icon indicating copy to clipboard operation
survey-library copied to clipboard

How to transform Survey.JS expressions to JavaScript, JSON, or YAML ?

Open ketanip opened this issue 3 years ago • 5 comments

Asking a question.

Currently we have a big survey.js survey and we are migrating it to react and custom elements. We are using a lot of expressions . So is there any way in which we could transform all the survey js expressions to JavaScript or some intermediate format like json or yaml ?

ketanip avatar Sep 22 '22 10:09 ketanip

Is there any syntax list available which can be used while manual conversion ?

ketanip avatar Sep 22 '22 15:09 ketanip

Here is the formal grammar description - https://github.com/surveyjs/survey-library/blob/master/src/expressions/grammar.pegjs

tsv2013 avatar Sep 22 '22 15:09 tsv2013

There are no tools to convert expressions. At least I don't know.

tsv2013 avatar Sep 22 '22 15:09 tsv2013

Is there any way to extract just the expression runner ?

ketanip avatar Sep 23 '22 09:09 ketanip

@ketanip What are trying to achieve? You can replace our expression engine with your own. One large enterprise does it. You have to implement IExpressionExecutor interface and then change createCreatorExecutor static function to your implementation.

Thank you, Andrew

andrewtelnov avatar Sep 23 '22 09:09 andrewtelnov

We had a big survey js form and we are trying to migrate away from it because of performance issues. Now we have successfully generate all the UI from JSON schema but we are running into problem when we are trying to parse the survey.js expressions.

ketanip avatar Sep 23 '22 15:09 ketanip

@ketanip Would it be easy to fix the performance issue with your Survey? You can pass your JSON and we will take a look. What version do you use? We have made optimization several times and surveys with 40K lines of JSON work fast.

Thank you, Andrew

andrewtelnov avatar Sep 23 '22 15:09 andrewtelnov

@andrewtelnov thanks for quick replies. We are planning to implement a lot of backend calls at various levels and it was just becoming hard to build frontend logic keeping in mind survey js compatibility and performance gains made by using native JSX were to good to be ignored. Now the app has a lot react only code so that's another thing.

We have decided to redo the entire thing manually again, so that solves the problem of converting from one form to another . Thanks for building such a great tool.

Thank you, Ketan

ketanip avatar Sep 24 '22 11:09 ketanip

@ketanip You are very welcome! Please keep in mind, that the latest versions of SurveyJS for react allows to replace the most of our React components with your components.

Thank you, Andrew

andrewtelnov avatar Sep 24 '22 11:09 andrewtelnov