Advanced Customization > Info*Engine User’s Guide > Task Webject Reference > Group Webjects > Set-Metadata
  
Set-Metadata
DESCRIPTION
Registers metadata values for groups, for individual elements within a group, and for attributes within elements. This metadata can then be read by higher layer applications, which can affect the processing of group, element, or attribute data.
* 
The Set-Metadata webject does not generate a new output group. Instead, it modifies the group specified by its GROUP_IN parameter.
SYNTAX
<ie:webject name="Set-Metadata" type="GRP">
  <ie:param name="ATTRIBUTE" data="name_of_attribute"/>
  <ie:param name="ELEMENT" data="index_of_element"/>
  <ie:param name="GROUP_IN" data="input_group_name"/>
  <ie:param name="NAME" data="name_of_meta_attribute"/>
  <ie:param name="SCOPE" data="[GROUP | ELEMENT | ATTRIBUTE]"/>
  <ie:param name="VALUE" data="value_of_meta_attribute"/>
</ie:webject>
PARAMETERS
Required
Select
Optional
GROUP_IN
SCOPE
VALUE
NAME
ELEMENT
ATTRIBUTE
ATTRIBUTE
Identifies the attribute for which the metadata is set.
If SCOPE is ATTRIBUTE, then you must specify both the ELEMENT and ATTRIBUTE parameters in order to identify the attribute against which the metadata is set.
ELEMENT
Identifies the element for which the metadata is set. The value of the parameter can be a simple integer that specifies the index of the element within the group, or can be specified as name=value where name is the name of an attribute, and value is the corresponding value of the attribute. If a name and value pair are specified, the webject locates the first element that contains an attribute with the specified name and value, and it sets the metadata for that element.
The value of ELEMENT can also be specified as “ * ”. In this case, all elements of the group are selected.
If the SCOPE parameter is ELEMENT, then you must specify the ELEMENT parameter. If the SCOPE parameter is ATTRIBUTE, then you must specify both the ELEMENT and ATTRIBUTE parameters in order to identify the attribute for which the metadata is set.
GROUP_IN
Specifies the name of the group for which metadata is registered. This parameter is required.
NAME
Specifies the name of the metadata attribute that is set. Multiple NAME and VALUE parameter pairs can be specified in order to set multiple metadata attributes in a single call to the webject. This parameter is required.
VALUE
Specifies the metadata value associated with the corresponding metadata named in the NAME parameter. Multiple NAME and VALUE parameter pairs may be specified in order to set multiple metadata attributes in a single call to the webject.
The default for this parameter is the null character. This parameter is optional.
SCOPE
Specifies the metadata scope. Valid values for this parameter are the following:
GROUP – Sets the metadata for the group as a whole.
ELEMENT – Sets the metadata for a particular element within the group. If SCOPE is specified as ELEMENT, then the ELEMENT parameter must also be specified.
ATTRIBUTE – Sets the metadata for an particular attribute of an element within the group. If SCOPE is specified as ATTRIBUTE, then both the ELEMENT and ATTRIBUTE parameters must also be specified.
The default value for this parameter is GROUP.
EXAMPLE
The following example JSP page registers metadata with a name of meta_data and a value of met_value on the group named “createdgroup” at the group level:
<%@page language="java" session="false"
       errorPage="XML_IEError.jsp" contentType="text/xml"%>

<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>

<ie:task uri="com/company/CreateGroup.xml"/>

<ie:webject name="Set-Metadata" type="GRP">
  <ie:param name="GROUP_IN" data="createdgroup"/>
  <ie:param name="SCOPE"  data="GROUP"/>
  <ie:param name="NAME"   data="meta_name"/>
  <ie:param name="VALUE"  data="met_value"/>
</ie:webject>

<ie:webject name="Display-XML" type="DSP">
  <ie:param name="MODE" data="FULL"/>
</ie:webject>
The following SetMetadataLevels.jsp file sets metadata for all three SCOPE values and displays the XML output using Display-XML:
<%@page language="java" session="false" errorPage="../IEError.jsp"%>

<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>

<ie:webject name="Create-Group" type="GRP">
  <ie:param name="ELEMENT" data="NAME=Sam Johnson:
          ADDRESS=1234 Main St.:EMAIL=sjohnson@somewhere.com"/>
  <ie:param name="ELEMENT" data="NAME=Harvy Anderson:
          ADDRESS=1234 Amber St.:EMAIL=handerson@somewhere.com"/>
  <ie:param name="ELEMENT" data="NAME=&lt;&gt;'&amp;&quot;:
          EMAIL=joconnor@somewhere.com"/>
  <ie:param name="GROUP_OUT" data="CREATE-RESULTS"/>
</ie:webject>

<ie:webject name="SeT-Metadata" type="GRP">
  <ie:param name="GROUP_IN" data="CREATE-RESULTS"/>
  <ie:param name="NAME" data="testattribute"/>
  <ie:param name="VALUE" data="attribute metadata"/>
  <ie:param name="SCOPE" data="ATTRIBUTE"/>
  <ie:param name="ELEMENT" data="*"/>
  <ie:param name="ATTRibute" data="name"/>
</ie:webject>

<ie:webject name="Set-Metadata" type="GRP">
  <ie:param name="GROUP_IN" data="CREATE-RESULTS"/>
  <ie:param name="NAME" data="testelement"/>
  <ie:param name="VALUE" data="element metadata"/>
  <ie:param name="SCOPE" data="ELEMENT"/>
  <ie:param name="ELEMENT" data="0"/>
</ie:webject>

<ie:webject name="Set-Metadata" type="GRP">
  <ie:param name="GROUP_IN" data="CREATE-RESULTS"/>
  <ie:param name="NAME" data="testgroup"/>
  <ie:param name="VALUE" data="group metadata"/>
  <ie:param name="SCOPE" data="GROUP"/>
</ie:webject>

<ie:webject name="Display-Xml" type="DSP">
  <ie:param name="Mode" data="FULL"/>
</ie:webject>
The XML output from executing the example is as follows:
  <?xml version="1.0" encoding="UTF-8" ?>
- <wc:COLLECTION xmlns:wc="http://www.ptc.com/infoengine/1.0">
  - <Unknown-Class-Name NAME="CREATE-RESULTS" TYPE="Object" STATUS="0">
    - <wc:INSTANCE>
      - <NAME>
          Sam Johnson
       - <wc:Meta>
          <testattribute>attribute metadata</testattribute>
         </wc:Meta>
       </NAME>
       <ADDRESS>1234 Main St.</ADDRESS>
       <EMAIL>sjohnson@somewhere.com</EMAIL>
       - <wc:Meta>
          <testelement>element metadata</testelement>
         </wc:Meta>
      </wc:INSTANCE>
    - <wc:INSTANCE>
      - <NAME>
          Harvy Anderson
       - <wc:Meta>
          <testattribute>attribute metadata</testattribute>
         </wc:Meta>
       </NAME>
       <ADDRESS>1234 Amber St.</ADDRESS>
       <EMAIL>handerson@somewhere.com</EMAIL>
      </wc:INSTANCE>
    - <wc:INSTANCE>
      - <NAME>
          &lt;&gt;'&amp;&quot;
       - <wc:Meta>
          <testattribute>attribute metadata</testattribute>
         </wc:Meta>
       </NAME>
       <EMAIL>joconnor@somewhere.com</EMAIL>
      </wc:INSTANCE>
      - <wc:Meta>
          <Class>Unknown-Class-Name</Class>
          <testgroup>group metadata</testgroup>
          <Status>0</Status>
        </wc:Meta>
     </Unknown-Class-Name>
  </wc:COLLECTION>