Difference between revisions of "COLUMNMETADATA()"

From Lianjapedia
Jump to: navigation, search
(Created page with "==Purpose== Function to return the METADATA string from the Active Data Dictionary associated with the specified column in the active table ==Syntax== COLUMNMETADATA(<expC1>)...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
Function to return the METADATA string from the Active Data Dictionary associated with the specified column in the active table
+
Function to return the metadata string from the Active Data Dictionary associated with the specified column
  
 
==Syntax==
 
==Syntax==
COLUMNMETADATA(<expC1>)
+
COLUMNMETADATA(<cColumn>)
  
 
==See Also==
 
==See Also==
[[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[JSON_DECODE()]], [[JSON_DECODE_FILE()]], [[JSON_ENCODE()]], [[LIST CLASSES]], [[LOADOBJECT()]], [[METADATA_DECODE()]], [[METADATA_ENCODE()]], [[METADATA_FINDTYPE()]], [[NEWOBJECT()]], [[OBJECT()]], [[PRINT_JSON()]], [[PRINT_HTML()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SQL SELECT]], [[SOCKET_CLOSE()]], [[SOCKET_LASTERROR()]], [[SOCKET_OPEN()]], [[SOCKET_PEEK()]], [[SOCKET_READ()]], [[SOCKET_SERVER()]], [[SOCKET_WRITE()]], [[TABLEMETADATA()]], [[WITH]], [[XML_DECODE_FILE()]]
+
[[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DATABASEMETADATA()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[JSON_DECODE()]], [[JSON_DECODE_FILE()]], [[JSON_ENCODE()]], [[LIST CLASSES]], [[LOADOBJECT()]], [[MetaData Editor]], [[METADATA_DECODE()]], [[METADATA_ENCODE()]], [[METADATA_FINDTYPE()]], [[NEWOBJECT()]], [[OBJECT()]], [[PRINT_JSON()]], [[PRINT_HTML()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SQL SELECT]], [[SOCKET_CLOSE()]], [[SOCKET_LASTERROR()]], [[SOCKET_OPEN()]], [[SOCKET_PEEK()]], [[SOCKET_READ()]], [[SOCKET_SERVER()]], [[SOCKET_WRITE()]], [[TABLEMETADATA()]], [[TABLEMETADATAVERSION()]], [[WITH]], [[XML_DECODE_FILE()]]
  
 
==Description==
 
==Description==
The COLUMNMETADATA() function is used to return the METADATA string from the Active Data Dictionary associated with the specified column in the active tableThis can be a JSON encoded complex object containing properties that are arrays of objects or nested objects. You can change the elements of the metadata object then update the Active Data Dictionary with the new metadata.
+
The COLUMNMETADATA() function is used to return the metadata string from the Active Data Dictionary associated with the specified column.  COLUMNMETADATA() returns an empty string if no metadata has been applied to the specified column or the column reference is not valid.
 +
 
 +
{| class="wikitable" width="100%"
 +
!width="25%"|Argument||width="75%"|Description
 +
|-
 +
|valign=top|<cColumn>||A character string reference to one of the following:<br>- column name of a column in the currently open table<br>- table.column in the currently open database<br>- database!table.column, which can be used whether the database is open or not
 +
|-
 +
|}
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
 +
// database!table.column
 +
? columnMetaData("southwind!customers.customerid")
 +
// table.column
 +
open database southwind
 +
? columnMetaData("customers.customerid")
 +
// column
 +
use customers
 +
? columnMetaData("customerid")
 +
 +
// Use with metadata_decode() and metadata_encode()
 +
open database southwind
 +
use customers
 +
omd = object()
 +
omd.caption = "Customer Name"
 +
omd.searchfield = .t.
 +
alter table customers modify constraint companyname metadata metadata_encode(omd)
 +
use customers
 +
omd = metadata_decode(columnMetaData("companyname"))
 +
omd.caption = "Customer"
 +
omd.picture = "@!"
 +
omd.searchfield = .t.
 +
alter table customers modify constraint companyname metadata metadata_encode(omd)
 +
?  metadata_decode(columnMetaData("companyname"))
 +
 +
  
 +
Object (refcnt=1)
 +
(
 +
    [caption] => Customer
 +
    [searchfield] => True
 +
    [picture] => @!
 +
)
 
</code>
 
</code>
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Metadata Functions]]
+
[[Category:Metadata API]]
 
[[Category:Data Import]]
 
[[Category:Data Import]]
 
[[Category:Lianja VFP Extensions]]
 
[[Category:Lianja VFP Extensions]]
 
[[Category:VFP Function Extensions]]
 
[[Category:VFP Function Extensions]]
 +
[[Category:Lianja v3.4]]

Latest revision as of 10:06, 5 April 2017

Purpose

Function to return the metadata string from the Active Data Dictionary associated with the specified column

Syntax

COLUMNMETADATA(<cColumn>)

See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), COMPOBJ(), CREATEOBJECT(), DATABASEMETADATA(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, JSON_DECODE(), JSON_DECODE_FILE(), JSON_ENCODE(), LIST CLASSES, LOADOBJECT(), MetaData Editor, METADATA_DECODE(), METADATA_ENCODE(), METADATA_FINDTYPE(), NEWOBJECT(), OBJECT(), PRINT_JSON(), PRINT_HTML(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, SOCKET_CLOSE(), SOCKET_LASTERROR(), SOCKET_OPEN(), SOCKET_PEEK(), SOCKET_READ(), SOCKET_SERVER(), SOCKET_WRITE(), TABLEMETADATA(), TABLEMETADATAVERSION(), WITH, XML_DECODE_FILE()

Description

The COLUMNMETADATA() function is used to return the metadata string from the Active Data Dictionary associated with the specified column. COLUMNMETADATA() returns an empty string if no metadata has been applied to the specified column or the column reference is not valid.

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

Example

// database!table.column
? columnMetaData("southwind!customers.customerid")
// table.column
open database southwind
? columnMetaData("customers.customerid")
// column
use customers
? columnMetaData("customerid")
 
// Use with metadata_decode() and metadata_encode()
open database southwind
use customers
omd = object()
omd.caption = "Customer Name"
omd.searchfield = .t.
alter table customers modify constraint companyname metadata metadata_encode(omd)
use customers
omd = metadata_decode(columnMetaData("companyname"))
omd.caption = "Customer"
omd.picture = "@!"
omd.searchfield = .t.
alter table customers modify constraint companyname metadata metadata_encode(omd)
?  metadata_decode(columnMetaData("companyname"))
 
 
 
Object (refcnt=1)
(
    [caption] => Customer
    [searchfield] => True
    [picture] => @!
)