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

docs: Added expressions for validating if a field is empty or not #4353

Merged
merged 2 commits into from
Oct 14, 2024
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
8 changes: 8 additions & 0 deletions docs/molgenis/use_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ expression itself is shown. Otherwise, the return value of the expression will b
| `/^([a-z]+)$/.test(name)` | Application of validation rule failed: /^([a-z]+)$/.test(name) |
| `if(!/^([a-z]+)$/.test(name))'name should contain only lowercase letters'` | Application of validation rule failed: name should contain only lowercase letters |

Special attention needs to be paid when validating if a field is empty or not (as filled in fields that get emptied are different from never filled in fields).
While [required](#required) should be used to ensure a field itself is filled, when creating expressions (that include other fields), use the following:

| validation | functioning |
|--------------------------|-----------------------------------|
| `columnName?.length > 0` | Field 'columnName' must be filled |
| `!(columnName?.length)` | Field 'columnName' must be empty |

Visible expressions must return a value that is not false or undefined, otherwise the column stays hidden in the user interface. In the event that javascript
throws an exception, this is shown in user interface/error message. For example:

Expand Down