Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update countInArray and other *InArray descriptions (fix #7037) #7049

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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