Difference between revisions of "CEData 1 0-getCEData"

From ADF Docs
Jump to: navigation, search
(Examples)
(Usage:)
Line 106: Line 106:
 
                       customElementFieldName="uniqueID",
 
                       customElementFieldName="uniqueID",
 
                       item='DF6D9B32-1143-FF53-952805B368AB301B'
 
                       item='DF6D9B32-1143-FF53-952805B368AB301B'
 +
                      );
 +
</cfscript>
 +
 +
<!---// loop over results (will only be records that matched the criteria)  --->
 +
<cfloop from="1" to="#arrayLen(data)#" index="itm">
 +
    <!---// renders data from the uniqueID and Title fields from the element --->
 +
    <cfoutput>#data[itm].values.uniqueID# #data[itm].values.Title#</cfoutput>
 +
</cfloop>
 +
</source>
 +
 +
Example 3a: Use getCEData(queryType='compareInList') to get the records that match the provided value for a specific field:
 +
 +
A example of two records stored a custom element:
 +
uniqueID: DF6D9B32-1143-FF53-952805B368AB301B
 +
csPageID: 2011,3010,4808,1660,3710
 +
uniqueID: DF6D9B32-1143-FF53-952805B368AB301B
 +
csPageID: 2011,3010,1660,3710
 +
 +
<source lang="cfm">
 +
<cfscript>
 +
    // get data from the "My Element" custom element by a uniqueID value
 +
    data = application.ADF.ceData.getCEData(
 +
                      customElementName="My Element",
 +
                      customElementFieldName="csPageID",
 +
                      item='4808',
 +
                      'compareInList'
 +
                      );
 +
</cfscript>
 +
 +
<!---// loop over results (will only be records that matched the criteria)  --->
 +
<cfloop from="1" to="#arrayLen(data)#" index="itm">
 +
    <!---// renders data from the uniqueID and Title fields from the element --->
 +
    <cfoutput>#data[itm].values.uniqueID# #data[itm].values.Title#</cfoutput>
 +
</cfloop>
 +
 +
Example 3b: Use getCEData(queryType='compareInList') to get the records that match each value in list with the values in a list stored in a specific custom element field:
 +
<source lang="cfm">
 +
<cfscript>
 +
    // get data from the "My Element" custom element by a uniqueID value
 +
    data = application.ADF.ceData.getCEData(
 +
                      customElementName="My Element",
 +
                      customElementFieldName="csPageIDs",
 +
                      item='2011,3010,4808,1660',
 +
                      'compareInList'
 
                       );
 
                       );
 
</cfscript>
 
</cfscript>

Revision as of 15:21, 17 September 2010

Attention: Do not change any text in the description, signature, and paramter sections.

Return to CEData_1_0

Description

Returns array of structs for all data matching the Custom Element.

Signature

public array getCEData ( string customElementName, string customElementFieldName, any item, string queryType, string searchValues, string searchFields )

Parameters

Required Name Type Description
required customElementName string
optional customElementFieldName string [Default: ]
  item any [Default: ]
  queryType string [Default: selected]
  searchValues string [Default: ]
  searchFields string [Default: ]

Examples

The getCEDdata function is handy way to get data out of a CommonSpot Custom Element. Making a call to this method will return the data as an Array of Structures for the element specified.

Usage:

Example 1: Use getCEData to get ALL records in a Custom Element:

<cfscript>
     // get data from the "My Element" custom element 
     data = application.ADF.ceData.getCEData(
                       customElementName="My Element"
                      );
</cfscript>

<!---// loop over results (will be all records from the Custom Element)  --->
<cfloop from="1" to="#arrayLen(data)#" index="itm">
    <!---// renders data from the uniqueID and Title fields from the element --->
    <cfoutput>#data[itm].values.uniqueID# #data[itm].values.Title#</cfoutput>
</cfloop>

Example 2: Use getCEData to get only the records that match the provided value for a specific field:

<cfscript>
     // get data from the "My Element" custom element by a uniqueID value
     data = application.ADF.ceData.getCEData(
                       customElementName="My Element",
                       customElementFieldName="uniqueID",
                       item='DF6D9B32-1143-FF53-952805B368AB301B'
                      );
</cfscript>

<!---// loop over results (will only be records that matched the criteria)  --->
<cfloop from="1" to="#arrayLen(data)#" index="itm">
    <!---// renders data from the uniqueID and Title fields from the element --->
    <cfoutput>#data[itm].values.uniqueID# #data[itm].values.Title#</cfoutput>
</cfloop>

Example 3a: Use getCEData(queryType='compareInList') to get the records that match the provided value for a specific field:

A example of two records stored a custom element: uniqueID: DF6D9B32-1143-FF53-952805B368AB301B csPageID: 2011,3010,4808,1660,3710 uniqueID: DF6D9B32-1143-FF53-952805B368AB301B csPageID: 2011,3010,1660,3710

<cfscript>
     // get data from the "My Element" custom element by a uniqueID value
     data = application.ADF.ceData.getCEData(
                       customElementName="My Element",
                       customElementFieldName="csPageID",
                       item='4808',
                       'compareInList'
                      );
</cfscript>

<!---// loop over results (will only be records that matched the criteria)  --->
<cfloop from="1" to="#arrayLen(data)#" index="itm">
    <!---// renders data from the uniqueID and Title fields from the element --->
    <cfoutput>#data[itm].values.uniqueID# #data[itm].values.Title#</cfoutput>
</cfloop>

Example 3b: Use getCEData(queryType='compareInList') to get the records that match each value in list with the values in a list stored in a specific custom element field: 
<source lang="cfm">
<cfscript>
     // get data from the "My Element" custom element by a uniqueID value
     data = application.ADF.ceData.getCEData(
                       customElementName="My Element",
                       customElementFieldName="csPageIDs",
                       item='2011,3010,4808,1660',
                       'compareInList'
                      );
</cfscript>

<!---// loop over results (will only be records that matched the criteria)  --->
<cfloop from="1" to="#arrayLen(data)#" index="itm">
    <!---// renders data from the uniqueID and Title fields from the element --->
    <cfoutput>#data[itm].values.uniqueID# #data[itm].values.Title#</cfoutput>
</cfloop>