StructGetMetaData

 

Description

Gets metadata values for key(s) in a struct.

Returns

Struct of metadata information and the struct type.

Category

History

Added in ColdFusion (2016 release) Update 2

See also

Syntax

StructSetMetaData(Struct struct)
StructSetMetaData(Struct struct)
StructSetMetaData(Struct struct)

Parameters

Parameters

Description

struct

(Required) The input structure.

Example

<cfscript>
example = structnew("ordered");
example.firstname = "Yes";
example.lastname = "Man";
// set the metadata for the struct keys
metadata = {firstname: {type:"string",name:"fname"},lastname:{name:"lname"}};
StructSetMetaData(example,metadata);
// retrieve the metadata for the keys and display
myMetadata=StructGetMetaData(example);
writedump(mymetadata);
</cfscript>
<cfscript> example = structnew("ordered"); example.firstname = "Yes"; example.lastname = "Man"; // set the metadata for the struct keys metadata = {firstname: {type:"string",name:"fname"},lastname:{name:"lname"}}; StructSetMetaData(example,metadata); // retrieve the metadata for the keys and display myMetadata=StructGetMetaData(example); writedump(mymetadata); </cfscript>
<cfscript>
       example = structnew("ordered");
       example.firstname = "Yes";
       example.lastname = "Man";
       // set the metadata for the struct keys
       metadata = {firstname: {type:"string",name:"fname"},lastname:{name:"lname"}};
       StructSetMetaData(example,metadata);
       // retrieve the metadata for the keys and display
       myMetadata=StructGetMetaData(example);
       writedump(mymetadata);
</cfscript>

Output

structgetmetadata output
structgetmetadata output

Get help faster and easier

New user?