ifn()

Read(1675) Label: sequence, first non-null member,

Description:

Compute x with each member of the sequence and return the first non-null member of the new sequence.

Syntax:

A.ifn(x)

 

ifn(x1,…,xn)

Equivalent to A.ifn(), where x1,…,xn are members of sequence A

Note:

The function loops through members of sequence A to compute expression x and returns the first non-null member.

Parameter:

A

A sequence

x

An expression; cannot be omitted when sequence A is a table sequence or a record sequence

Return value:

The first non-null member

Example:

When A is a sequence:

 

A

 

1

=[1,2,4].ifn()

1.

2

=[1,2,4].ifn(~*10)

10; return the first member after computing the expression.

3

=[null,2,3,4].ifn()

2; return the first non-null member.

4

=[null,"",2,3,4].ifn()

“”.

5

=ifn(null,2,3,4)

2, which is same as A3.

When A is a table sequence or a record sequence:

 

A

 

1

=create(ID,NAME,GENDER).record([1,"Rebecca",,2,"Ashley","F",3,"Matthew","M"])

2

=A1.ifn(NAME)

Get the first non-null NAME value.

3

=A1.ifn(GENDER)

Get the first non-null GENDER value.