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.12k stars 802 forks source link

The filtering condition without apostrophes doesn't work for the countInArray function #8371

Closed JaneSjs closed 3 months ago

JaneSjs commented 3 months ago

The filtering expression doesn't work for the countInArray function. The result should be 2, however, the filtering criteria is not applied: countInArray({question1}, 'question2', {question2} <> 'Item 2').

{
 "logoPosition": "right",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "paneldynamic",
     "name": "question1",
     "templateElements": [
      {
       "type": "dropdown",
       "name": "question2",
       "choices": [
        "Item 1",
        "Item 2",
        "Item 3"
       ]
      }
     ]
    },
    {
     "type": "expression",
     "name": "question3",
     "startWithNewLine": false,
     "title": "Count the number of items which are not equal to 'Item 2'",
     "expression": "countInArray({question1}, 'question2', {question2} <> 'Item 2')"
    }
   ]
  }
 ]
}

image