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

When sorting or filtering by a boolean field treat null as false #69

Open
vyacheslav-pushkin opened this issue Sep 18, 2019 · 0 comments
Assignees
Labels
type: enhancement New feature or request

Comments

@vyacheslav-pushkin
Copy link
Contributor

vyacheslav-pushkin commented Sep 18, 2019

Environment

  • Platform version: 7.0.10

1. Sorting

Sorting by a boolean field containing nulls results in nulls being on top regardless of sort order

Request examples

Descending order:

/app/rest/v2/entities/mpg$Car/search?view=_base&sort=-wheelOnRight

Ascending order:

/app/rest/v2/entities/mpg$Car/search?view=_base&sort=+wheelOnRight

Expected result

Descending order: true values are on top, followed by false and null values
Ascending order: false and null values are on top, followed by true values

Actual result

Descending order: null values are on top, followed by true values, followed by false values
Ascending order: null values are on top, followed by false values, followed by true values

Note

In user interfaces both null and false are likely to represent the same state and can be displayed e.g. as an empty checkbox. Sorting in descending order will result in empty checkboxes followed by checked checkboxes followed by empty checkboxes.

2. Filtering

null values are never returned

Example

Filter:

filter: {"conditions":[{"property":"wheelOnRight","operator":"=","value":"false"}]}

Records:

{ id: 0, booleanField: true }
{ id: 1, booleanField: false }
{ id: 2, booleanField: null }

Expected result

Returns records with id 1 and 2

Actual result

Returns record with id 1

@vyacheslav-pushkin vyacheslav-pushkin changed the title When sorting by a boolean field treat null as false When sorting or filtering by a boolean field treat null as false Sep 26, 2019
@knstvk knstvk added the type: enhancement New feature or request label Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants