Skip to content

Commit

Permalink
Rewrote explanation a bit to include reference to required
Browse files Browse the repository at this point in the history
  • Loading branch information
svandenhoek committed Oct 14, 2024
1 parent 844a93c commit 2f8b671
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/molgenis/use_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ expression itself is shown. Otherwise, the return value of the expression will b
| `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).
To ensure correct behaviour, use the following:
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 |
|----------------------------|--------------------------|
| `mustBeFilled?.length > 0` | Fails if field is empty |
| `!(mustBeEmpty?.length)` | Fails if field is filled |
| 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

0 comments on commit 2f8b671

Please sign in to comment.