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

What is the full syntax for conditional expressions? #8851

Closed jzju closed 1 month ago

jzju commented 1 month ago

There are some examples in the docs but where are the complete documentation? E.g. it uses and like python but = for equal instead of regular ==. is there an in operator like {question} in ['a', 'b'] or len({multiselect} > 2)

Is this boolean syntax homemade provided by external library?

https://github.com/surveyjs/survey-library/blob/390a2c3f61ac0859955acab636e00717895d5cd9/docs/design-survey-conditional-logic.md?plain=1#L691-L702

JaneSjs commented 1 month ago

Hello @jzju, Thank you for your inquiry. SurveyJS uses the third-party PEG.js library. You can review supported expression operators at https://github.com/surveyjs/survey-library/blob/390a2c3f61ac0859955acab636e00717895d5cd9/packages/survey-core/src/expressions/grammar.pegjs. We'll consider updating our documentation and adding more information about supported expression operators.

Regarding your specific questions:

Drop me a line if you have additional questions.