Map and Table Calculation

IFNOTUNDEF( ) function

If a is not undefined, then return b, else return undefined.
If a is not undefined, then return b, else return c.

Syntax

IFNOTUNDEF(a, b)
IFNOTUNDEF(a, b, c)

Input

a is the test condition: a boolean expression containing at least one map name or one column name.
b, c an expression containing at least one map name or one column name, or simply a value, class name, ID, etc.

Output

IFNOTUNDEF returns: if a is not undefined, b is returned;
if a is undefined and c is specified then c is returned;
if a is undefined and c is not specified, undefined is returned.
Domain:

system domain Value;

  • when using IFNOTUNDEF(a, b), the output domain will use reals if b uses real values; else integers will be used;
  • when using IFNOTUNDEF(a, b, c), the output domain will use reals when either b or c uses real values; else integers will be used;

the class/ID domain returned by c;

  • if c returns a string or undefined value, the class/ID domain returned by b;
  • if both b and c return a string, no default output domain;
  • if c is not specified and b returns a string or undefined value, the class/ID domain of a.

Notes:

Tip:

When the definition symbol = is used, a dependent output map or dependent output column is created; when the assignment symbol := is used, the dependency link is immediately broken after the output map/column has been calculated.

Usable in

MapCalc, TabCalc

Examples

MapCalc example using a value map:

OutMap1 = IFNOTUNDEF(InMap,100)

OutMap2 = IFNOTUNDEF(InMap,10,50)

 

InMap

OutMap1

OutMap2

3 ? 4
? 1 ?
5 2 6
100 ? 100
? 100 ?
100 100 100
10 50 10
50 10 50
10 10 10

 

MapCalc example using a class map:

OutMap1 = IFNOTUNDEF(Landuse,"Suitable")

OutMap2 = IFNOTUNDEF(Landuse,"Suitable","Not Suitable")

 

Landuse

OutMap1

OutMap2

? F G
L L ?
G ? F
? S S
S S ?
S ? S
N S S
S S N
S N S

 

Note:

In map Landuse: F=Forest, G=Grassland and L=Lake.

TabCalc examples:

OutCol1 = IFNOTUNDEF(Population,1000)

OutCol2 = IFNOTUNDEF(Population,1000,5000)

OutCol3 = IFNOTUNDEF(Landuse,"Suitable")

OutCol4 = IFNOTUNDEF(Landuse,"Suitable","Not Suitable")

 

Sitenr

Population

Landuse

OutCol1

OutCol2

OutCol3

OutCol4

1

850

Crops

1000

1000

Suitable

Suitable

2

?

Grassland

?

5000

Suitable

Suitable

3

600

Urban area

1000

1000

Suitable

Suitable

4

950

?

1000

1000

?

Not Suitable

5

1250

Crops

1000

1000

Suitable

Suitable

6

450

?

1000

1000

?

Not Suitable

7

?

Grassland

?

5000

Suitable

Suitable

8

900

Urban area

1000

1000

Suitable

Suitable

 

See also:

ISUNDEF
IFUNDEF
IFF
Map and Table Calculation : Assigning undefined values
How to calculate with undefineds in maps and tables
Map and Table Calculation : Merging domains (workaround)