webCOMAND

#CONTEXT

#CONTEXT brings an object into variable scope.  In other words, it makes all of the fields within the object available as variables with the same name as each field's Identifier.  It is similar to #LIST, except it is used to access only one object, such as a field that contains a single embedded object or reference.

If a Content Type has no Unique/Key fields, the OID can be specified as the Unique Value. If a Content Type has one or more Unique/Key fields, the first will be used for comparison against FirstUniqueFieldValue.

If more than one object of the specified Content Type matches the FirstUniqueFieldValue or Field=Value parameter, the object "closest" to the Publication's Content Folder will be used.  If both objects are the same distance, the one with the lowest OID will be chosen.

#CONTEXT can be used inside a #LIST block to reference embedded objects.

This statement does not produce output itself, but the contents inside the block will be output.

Prototype

#CONTEXT($object) ... #ENDCONTEXT
#CONTEXT($content_type, $object) ... #ENDCONTEXT
#CONTEXT($content_type, $first_unique_field_value) ... #ENDCONTEXT
#CONTEXT($content_type, <field>=<value>) ... #ENDCONTEXT

Parameters

  • object - A variable containing a single object.
  • content_type - A Content Type Identifier.
  • first_unique_field_value - A value to uniquely identify the object of a specific content type.  When Field=Value notation is not used, the first Unique/Key field of a content type is assumed.
  • <field>=<value> - A field/value pair can be used to match a specific field against a specific value.

Example

#/ display a report object's title
#CONTEXT($Report)$ReportTitle#ENDCONEXT 
#CONTEXT(Report, $Report)$ReportTitle#ENDCONEXT
#CONTEXT(Report, $ReportOID)$ReportTitle#ENDCONEXT
#CONTEXT(Report, Month=2)$ReportTitle#ENDCONEXT

Related

#LIST