Question T12360
Visible to All Users

Limit Logic Operations and Set the Default

created 2 years ago (modified 2 years ago)

Hi
I'm looking for a way to limit the logic operations that are offered in the Creator.
Specifically, I would like to hide the "greater than" and similar logic options.

I've found this support ticket, but I'm not sure if it's still valid or if I'm doing something wrong. I get the error below.
I'm also confused about the " ["!file"]" in that lineā€¦

My related second question is if there is a way to set the default logic option. I would like to set this to "anyof", if possible.

Thank you!
Jorgos

Code
Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'SurveyCreator.SurveyPropertyEditorFactory.operators = { equal: ["!file"] }')

Answers approved by surveyjs Support

created 2 years ago (modified 2 years ago)

Hello,
The following code should be used for Creator V2:
SurveyCreator.settings.operators.equal = ["!file"];
It means that file question doesn't support "equal" operator. Here is the link to operators settings source code.
To delete greater, you can use the following code:
delete SurveyCreator.settings.operators.greater;

At the current moment "equal" is default operator and it is hard coded. If you choose "anyof" as default then for text editor it will not be available, since "allof" is supported by checkbox, radiogroup, dropdown and imagepicker.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (1)

      Hello Jorgos,
      I have created a new GitHub issue. You can check the progress. I can't promise we will implement it in a week, but hopefully it will be implemented in several weeks.

      Thank you,
      Andrew
      SurveyJS Team

        That's great, thank you!

          Hello Jorgos,
          The functionality has been implemented, but PR is not merged yet. I believe it will be merged before releasing next version next week.
          You will be able to use the following code:

          Code
          import { settings } from "survey-creator-core"; settings.logic.defaultOperator = "notempty";

          PS: There is no private information in this ticket, you can make it public.

          Thank you,
          Andrew
          SurveyJS Team