TABLEMETADATA()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to return the metadata string from the Active Data Dictionary associated with the active or specified table

Syntax

TABLEMETADATA([<cTable> | <nWorkarea>])

See Also

ACLASS(), ADDPROPERTY(), ALTER TABLE, AMEMBERS(), COLUMNMETADATA(), COMPOBJ(), CREATE TABLE, CREATEOBJECT(), DATABASEMETADATA(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, JSON_DECODE(), JSON_DECODE_FILE(), JSON_ENCODE(), Lianja MetaData API, LIST CLASSES, LOADOBJECT(), MetaData Editor, METADATA_DECODE(), METADATA_ENCODE(), METADATA_FINDTYPE(), METADATA_VALUE(), NEWOBJECT(), OBJECT(), PRINT_JSON(), PRINT_HTML(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, TABLEMETADATAVERSION()

Description

The TABLEMETADATA() function is used to return the metadata string from the Active Data Dictionary associated with the active or specified table. If no metadata has been applied to the table or there is no table open in the current workarea, TABLEMETADATA() returns an empty string.

If the optional <cTable> | <nWorkarea> is specified, then the function will return the metadata from the specified table.

Argument Description
<cTable> A character string reference to one of the following:
- alias name of a currently open table
- name of a table in the currently open database
- database!table, which can be used whether the database is open or not
<nWorkarea> An integer workarea reference.

TABLEMETADATA() returns an empty string if no metadata has been applied to the specified table or the table or workarea reference is not valid.

Example

open database southwind
use customers alias cust in 1
// Current table
? tablemetadata()
select 0
// By workarea
? tablemetadata(1)
// By alias
? tablemetadata("cust")
select cust
use
// Table in current database
? tablemetadata("customers")
close database
// Table in specified database
? tablemetadata("southwind!customers")
 
// Use with metadata_decode() and metadata_encode()
open database southwind
use customers
omd = metadata_decode(tableMetaData())
omd.searchpanelvisible = .t.
use
alter table customers metadata metadata_encode(omd)