NumCols() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns the number of columns in a specified table. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

NumCols( table )

table is the name of an open table.

Return Value

SmallInt

Description

The NumCols() function returns the number of columns contained in the specified open table.

The number of columns returned by NumCols() does not include the special column known as Object (or Obj for short), which refers to the graphical objects attached to mappable tables. Similarly, the number of columns returned does not include the special column known as RowID.

Note: If a table has temporary columns (for example, because of an Add Column statement), the number returned by NumCols() includes the temporary column(s).

Error Conditions

ERR_TABLE_NOT_FOUND (405) error generated if the specified table is not available.

Example

Dim i_counter As Integer
Open Table "world"
i_counter = NumCols(world)

See Also:

ColumnInfo() function, NumTables() function, TableInfo() function