not( value )
Converts true
into false
, and false
into true
.
See also:
true
.false
.Keyword | Type | Description |
---|---|---|
|
Boolean |
A Boolean or array of Booleans to be toggled. |
Boolean
not()
. If any values cannot be cast to a Boolean, the function returns an error.not()
can accept a list of values. If a list is provided, the result returns a list of the same length with each input value evaluated.not({true, true, false})
not(true, true, false)
not()
function.not()
function returns an error if any values provided are null.If it's possible that the input value to the not()
function could be null, an alternate approach is to do a comparison against the false()
function using the <>
operator. For example, the following expressions result in the same outcome if local!value
is true
or false
. However, if local!value
is null, the first expression will return an error, while the second expression returns true
.
not(local!value)
local!value <> false
1
2
3
4
5
6
7
8
9
10
if(
not(
a!isUserMemberOfGroup(
username: loggedInUser(),
groups: cons!MY_GROUP
)
),
"Not Authorized",
"Authorized",
)
Returns "Not Authorized"
if the user is not in the group.
When using not()
in a logical function, the expression can usually be simplified to avoid using not()
. In this example, you can remove not()
from the if()
condition and switch the values for the true and false outcomes. This has the same result and will be easier for another developer to read and understand.
1
2
3
4
5
6
7
8
if(
a!isUserMemberOfGroup(
username: loggedInUser(),
groups: cons!MY_GROUP
),
"Authorized",
"Not Authorized",
)
Paste this example into an interface to see the result.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
a!localVariables(
local!selected: true,
a!buttonWidget(
label: if(
local!selected,
"Selected",
"Not Selected"
),
style: if(
local!selected,
"PRIMARY",
"NORMAL"
),
value: not(local!selected),
saveInto: local!selected
)
)
When the button is selected, the variable value is flipped from true to false or vice versa.
Feature | Compatibility | Note |
---|---|---|
Portals | Compatible | |
Offline Mobile | Compatible | |
Sync-Time Custom Record Fields | Compatible | Can be used to create a custom record field that only evaluates at sync time. |
Real-Time Custom Record Fields | Incompatible | Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. |
Process Reports | Compatible | |
Process Events | Compatible |
not() Function