Skip to content

Commit

Permalink
Update countInArray and other *InArray descriptions (fix #7037) (#…
Browse files Browse the repository at this point in the history
…7049)

Co-authored-by: Roman Tsukanov <[email protected]>
  • Loading branch information
RomanTsukanov and Roman Tsukanov authored Sep 29, 2023
1 parent e146491 commit 29cf60c
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions docs/design-survey-conditional-logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ Returns the average of passed numbers.
#### `sumInArray`
*Definition*: `sumInArray(questionName: expression, propertyName: string): number`
*Definition*: `sumInArray(questionName: expression, dataFieldName: string): number`
Returns the sum of numbers in an array taken from a given question property.
Returns the sum of numbers taken from a specified data field. This data field is searched in an array that contains a user response to a [Dynamic Panel](/form-library/examples/duplicate-group-of-fields-in-form/) question or a [matrix](/form-library/examples/single-selection-matrix-table-question/) question of any type.
*Example*: `"expression": "sumInArray({matrixdynamic1}, 'total') > 1000"`
*Example*: `"expression": "sumInArray({matrixdynamic}, 'total') > 1000"`
[View Source Code](https://github.com/surveyjs/survey-library/blob/68eb0054dc83d2f45a6daa1042bf7440c8faf007/src/functionsfactory.ts#L164-L171 (linkStyle))
[View Demo](https://surveyjs.io/Examples/Library?id=questiontype-expression#content-js (linkStyle))
Expand All @@ -394,47 +394,47 @@ Returns the sum of numbers in an array taken from a given question property.
#### `maxInArray`
*Definition*: `maxInArray(questionName: expression, propertyName: string): number`
*Definition*: `maxInArray(questionName: expression, dataFieldName: string): number`
Returns the maximum of numbers in an array taken from a given question property.
Returns the maximum of numbers taken from a specified data field. This data field is searched in an array that contains a user response to a [Dynamic Panel](/form-library/examples/duplicate-group-of-fields-in-form/) question or a [matrix](/form-library/examples/single-selection-matrix-table-question/) question of any type.
*Example*: `"expression": "maxInArray({matrixdynamic4}, 'quantity') > 20"`
*Example*: `"expression": "maxInArray({matrixdynamic}, 'quantity') > 20"`
[View Source Code](https://github.com/surveyjs/survey-library/blob/68eb0054dc83d2f45a6daa1042bf7440c8faf007/src/functionsfactory.ts#L181-L187 (linkStyle))
---
#### `minInArray`
*Definition*: `minInArray(questionName: expression, propertyName: string): number`
*Definition*: `minInArray(questionName: expression, dataFieldName: string): number`
Returns the minimum of numbers in an array taken from a given question property.
Returns the minimum of numbers taken from a specified data field. This data field is searched in an array that contains a user response to a [Dynamic Panel](/form-library/examples/duplicate-group-of-fields-in-form/) question or a [matrix](/form-library/examples/single-selection-matrix-table-question/) question of any type.
*Example*: `"expression": "minInArray({matrixdynamic3}, 'quantity') > 5"`
*Example*: `"expression": "minInArray({matrixdynamic}, 'quantity') > 5"`
[View Source Code](https://github.com/surveyjs/survey-library/blob/68eb0054dc83d2f45a6daa1042bf7440c8faf007/src/functionsfactory.ts#L173-L179 (linkStyle))
---
#### `avgInArray`
*Definition*: `avgInArray(questionName: expression, propertyName: string): number`
*Definition*: `avgInArray(questionName: expression, dataFieldName: string): number`
Returns the average of numbers in an array taken from a given question property.
Returns the average of numbers taken from a specified data field. This data field is searched in an array that contains a user response to a [Dynamic Panel](/form-library/examples/duplicate-group-of-fields-in-form/) question or a [matrix](/form-library/examples/single-selection-matrix-table-question/) question of any type.
*Example*: `"expression": "avgInArray({matrixdynamic2}, 'quantity') > 10"`
*Example*: `"expression": "avgInArray({matrixdynamic}, 'quantity') > 10"`
[View Source Code](https://github.com/surveyjs/survey-library/blob/68eb0054dc83d2f45a6daa1042bf7440c8faf007/src/functionsfactory.ts#L198-L203 (linkStyle))
---
#### `countInArray`
*Definition*: `countInArray(questionName: expression, propertyName: string): number`
*Definition*: `countInArray(questionName: expression, dataFieldName: string): number`
Returns the total number of items in an array taken from a given question property.
Returns the total number of array items in which a specified data field has a value other than `null` or `undefined`. This data field is searched in an array that contains a user response to a [Dynamic Panel](/form-library/examples/duplicate-group-of-fields-in-form/) question or a [matrix](/form-library/examples/single-selection-matrix-table-question/) question of any type.
*Example*: `"expression": "countInArray({matrixdynamic5}) > 10"`
*Example*: `"expression": "countInArray({matrixdynamic}, 'quantity') > 10"`
[View Source Code](https://github.com/surveyjs/survey-library/blob/68eb0054dc83d2f45a6daa1042bf7440c8faf007/src/functionsfactory.ts#L189-L196 (linkStyle))
Expand Down

0 comments on commit 29cf60c

Please sign in to comment.