Here’s how to use ifn() function.
Description:
Get the first non-null member of a sequence.
Syntax:
A.ifn() |
Equivalent to ifn(x1,…,xn) |
Note:
The function gets the first non-null member of sequence A.
Parameter:
A |
A sequence with the length of n |
Return value:
The first non-null member of the sequence.
Example:
|
A |
|
1 |
=[1,2,4].ifn() |
1 |
2 |
=[null,2,3,4].ifn() |
2 |
3 |
=[null,2,null,4].ifn() |
2 |
4 |
=ifn(null,1,2,4) |
1 |
Related function:
Description:
Compute x with each member of the sequence and return the first non-null member of the new sequence.
Syntax:
A.ifn(x) |
Equivalent to A.(x).ifn() |
Note:
The function loops through members of sequence A to compute expression x and return the first non-null member of the new sequence.
Parameter:
A |
A sequence |
x |
Generally an expression of a single field name, or a legal expression composed of multiple field names |
Return value:
The first non-null member of the new sequence
Example:
|
A |
|
1 |
=demo.query("select * from EMPLOYEE") |
|
2 |
=A1.ifn(SALARY) |
Return the first non-null value of SALARY |
3 |
=A1.(SALARY+100).ifn() |
Add 100 to the salary of each employee and return the salary of the first employee |
Related function: