Purpose
Returns information about an open table. Has a define for FME (Universal Data) tables. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
TableInfo( table_id, attribute )
table_id is a string representing a table name, a positive integer table number, or 0 (zero).
attribute is an integer code indicating which aspect of the table to return (see table of attributes below). The following example returns the coordsys clause with bounds:
TableInfo(table_id, TAB_INFO_COORDSYS_CLAUSE)
TableInfo(table_id, 29)
Return Value
String, SmallInt, or logical, depending on the attribute parameter specified.
Description
The TableInfo() function returns one piece of information about an open table.
The table_id can be a string representing the name of the open table. Alternately, table_id can be a table number. If table_id is 0 (zero), the TableInfo() function returns information about the most recently opened, most recently created table; or a table that has just been renamed. This allows a MapBasic program to determine the working name of a table in cases where the Open Table statement did not include an As clause. If there are no open tables, or if the most recently-opened table has already been closed, the TableInfo() function generates an error.
The attribute parameter can be any value from the table below. Codes in the left column (for example, TAB_INFO_NAME) are defined in MAPBASIC.DEF.
attribute code | ID | TableInfo() returns |
---|---|---|
TAB_INFO_NAME | 1 | String result, indicating the name of the table. |
TAB_INFO_NUM | 2 | SmallInt result, indicating the number of the table. |
TAB_INFO_TYPE | 3 | SmallInt result, indicating the type of table. The returned value will match one of these:
|
TAB_INFO_NCOLS | 4 | SmallInt, indicating the number of columns. |
TAB_INFO_MAPPABLE | 5 | Logical result; TRUE if the table is mappable. |
TAB_INFO_READONLY | 6 | Logical result; TRUE if the table is read-only. |
TAB_INFO_TEMP | 7 | Logical result; TRUE if the table is temporary (for example, QUERY1). |
TAB_INFO_NROWS | 8 | Integer, indicating the number of rows. |
TAB_INFO_EDITED | 9 | Logical result; TRUE if table has unsaved edits. |
TAB_INFO_FASTEDIT | 10 | Logical result; TRUE if the table has FastEdit mode turned on, FALSE otherwise. (See Set Table statement for information on FastEdit mode.) |
TAB_INFO_UNDO | 11 | Logical result; TRUE if the undo system is being used with the specified table, or FALSE if the undo system has been turned off for the table through the Set Table statement. |
TAB_INFO_MAPPABLE_TABLE | 12 | String result indicating the name of the table containing graphical objects. Use this code when you are working with a table that is actually a relational join of two other tables, and you need to know the name of the base table that contains the graphical objects. |
TAB_INFO_USERMAP | 13 | Logical result: FALSE if a Set Table statement has set the UserMap option to Off. |
TAB_INFO_USERBROWSE | 14 | Logical result: FALSE if a Set Table statement has set the UserBrowse option to Off. |
TAB_INFO_USERCLOSE | 15 | Logical result: FALSE if a Set Table statement has set the UserClose option to Off. |
TAB_INFO_USEREDITABLE | 16 | Logical result: FALSE if a Set Table statement has set the UserEdit option to Off. |
TAB_INFO_USERREMOVEMAP | 17 | Logical result: FALSE if a Set Table statement has set the UserRemoveMap option to Off. |
TAB_INFO_USERDISPLAYMAP | 18 | Logical result: FALSE if a Set Table statement has set the UserDisplayMap option to Off. |
TAB_INFO_TABFILE | 19 | String result, representing the table's full directory path. Returns an empty string if the table is a query table. |
TAB_INFO_MINX, TAB_INFO_MINY, TAB_INFO_MAXX, TAB_INFO_MAXY |
20 21 22 23 |
Float results, indicating the minimum and maximum x- and y-coordinates of all objects in the table. |
TAB_INFO_SEAMLESS | 24 | Logical result; TRUE if seamless behavior is on for this table. |
TAB_INFO_COORDSYS_MINX, TAB_INFO_COORDSYS_MINY, TAB_INFO_COORDSYS_MAXX, TAB_INFO_COORDSYS_MAXY |
25 26 27 28 |
Float results, indicating the minimum or maximum x or y map coordinates that the table is able to store; if table is not mappable, returns zero. |
TAB_INFO_COORDSYS_CLAUSE | 29 | String result, indicating the table's CoordSys clause, such as "CoordSys Earth Projection 1, 0". Returns empty string if table is not mappable. |
TAB_INFO_COORDSYS_NAME | 30 | String result, representing the name of the coordinate system as listed in MAPINFOW.PRJ (but without the optional "\p..." suffix that appears in MAPINFOW.PRJ). Returns empty string if table is not mappable, or if coordinate system is not found in MAPINFOW.PRJ. |
TAB_INFO_NREFS | 31 | SmallInt, indicating the number of other base tables that reference this table. (Returns zero for most tables, or non-zero in cases where a table is defined as a join of two other tables, such as a StreetInfo table.) May only be used with base tables (TAB_TYPE_BASE). |
TAB_INFO_SUPPORT_MZ | 32 | Logical result: TRUE if table supports m and z-values. |
TAB_INFO_Z_UNIT_SET | 33 | Logical result: TRUE if unit is set for z-values. |
TAB_INFO_Z_UNIT | 34 | String result: indicates distance units used for z-values. Return empty string if units are not specified. |
TAB_INFO_BROWSER_LIST | 35 | String result: indicates which columns will be displayed in a browser. This information is stored in table metadata. Return empty string if this information is absent. |
TAB_INFO_THEME_METADATA | 36 | Logical result; TRUE if the table has default theme metadata. |
TAB_INFO_COORDSYS_CLAUSE_WITHOUT_BOUNDS | 37 |
String result, representing the table's CoordSys clause without bounds.
returns the coordsys clause without bounds or
returns the coordsys clause with bounds |
TAB_INFO_DESCRIPTION | 38 | String result: returns a table description string that can be specified in a TAB file. If there is no description in a TAB file, then it returns an empty string. |
TAB_INFO_TABLEID | 39 | String result: returns the unique table ID for a TAB file. If there is no Table ID in a TAB file, then it returns an empty string. |
TAB_INFO_PARENTTABLEID | 40 | String result: returns the table ID from which this TAB file was copied. If this was not created from another TAB file, then it returns an empty string. |
TAB_INFO_ISMANAGED | 41 | Logical result: TRUE if table is managed in a library service. |
TAB_INFO_ADSK_TEXTOBJECT | 42 | Logical result: TRUE if the table is an Autodesk text table. |
TAB_INFO_OVERRIDE_COORDINATE_ORDER | 43 | Logical result: TRUE if the table is a Web Feature Service (WFS) table or a Web Map Service (WMS) table with the coordinate order override turned on. |
TAB_INFO_PERSIST | 44 | Logical result: TRUE if the table should be persisted to the workspace. |
TAB_INFO_PREFER_HTML_FOR_INFO_TOOL | 45 | Logical result: TRUE when set to HTML. |
TAB_INFO_INUSE | 46 | Logical result: TRUE when a table is in use, and FALSE when it is not in use. |
TAB_INFO_DATA_FORMAT | 47 | SmallInt result: indicates the data format of the base table (which is not a WMF, WFS, raster, FME, or query). The return values are:
|
TAB_INFO_CHARSET | 48 | String value: the name of the table character set. |
TAB_INFO_MAP_BLOCKSIZE | 49 | SmallInt result: the block size of the map file. If table is not mappable, returns -1. (A table without a .map file returns -1.) |
TAB_INFO_READVERSION | 50 | Integer result: earliest version that can read the table. |
TAB_INFO_EDITVERSION | 51 | Integer result: earliest version that can edit the table. |
TAB_INFO_READALLVERSION | 52 | Integer result: earliest version that can read the entire table. |
TAB_INFO_LOCALE | 53 | String value: returns a locale string, such as "en-US" or "ja-JP", from the running instance of MapInfo Pro. The value comes from the Operating System. For a list of locale strings, see the Microsoft Table of Language Culture Names, Codes, and ISO Values Method web site at https://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx. |
TAB_INFO_CONNECTIONS_COUNT | 54 | SmallInt result: the count of database connections of a table.
The return value can be used for running the TableConnectionInfo() function. |
TAB_INFO_SCHEMAS_COUNT | 55 | SmallInt result: the count of different database schemas of a table.
The return value can be used for running the TableSchemaInfo() function. |
TAB_INFO_QUERY_STRING | 56 | String value: returns the query string of a query table. Only returns a query sting from query table create from a SQL select dialog or from a SQL query made in a MapBasic window in MapInfo Pro.
If the query table is invalid, returns the error "table is not a valid query table". If the table is valid and there is no SQL statement available (when querying from an MBX file for example), returns an empty string. |
TAB_INFO_ISHIDDEN | 57 | Logical value: returns TRUE when a table is hidden. Hidden tables are not visible in MapInfo Pro, so you need to know the alias of a hidden table to perform an operation on it. |
TAB_INFO_NUM_BASETABLES |
58 | Integer value: returns the number of base tables that comprise a join within a Query
table. For example,
TableInfo(MyQuery, TAB_INFO_NUM_BASETABLES) would return 2 as a result. |
TAB_INFO_NUM_BASETABLE_ALIASES | 59 | String value: returns a comma separated list of base tables that comprise a join
within a Query table. For example,
|
TAB_INFO_DOMINANT_OBJECT_TYPE | 60 | Returns the most common object type from the table. The return values are:
|
TAB_INFO_ISFILTER | 61 |
Logical result: TRUE if the table is used as a layer filter table, otherwise FALSE See LayerInfo() LAYER_INFO_FILTER_TABLE_ALIAS
|
Error Conditions
ERR_TABLE_NOT_FOUND (405) error is generated if the specified table was not available.
ERR_FCN_ARG_RANGE (644) error is generated if an argument is outside of the valid range.
Examples
Include "mapbasic.def"
Dim i_numcols As SmallInt, L_mappable As Logical
Open Table "world"
i_numcols = TableInfo("world", TAB_INFO_NCOLS)
L_mappable = TableInfo("world", TAB_INFO_MAPPABLE)
TableInfo(table_id, TAB_INFO_COORDSYS_CLAUSE)
TableInfo(table_id, 29) - Returns the coordsys clause with bounds
To determine if a Web Feature Service (WFS) table has the coordinate order override set, use the TAB_INFO_OVERRIDE_COORDINATE_ORDER (43) attribute. This returns TRUE if the table is a WFS table with the coordinate order override turned on and it returns FALSE otherwise.
TableInfo(MyWFSTable, TAB_INFO_OVERRIDE_COORDINATE_ORDER)
See Also: