Advanced Customization > Info*Engine User’s Guide > Task Webject Reference > Group Webjects > Format-Group
  
Format-Group
DESCRIPTION
Formats specific groups of information by adding special characters to that information. For example, this webject could be used to place the dollar sign at the beginning of each item in a group of salary amounts. This webject can also be used to combine multiple attributes into one long attribute for formatting purposes.
SYNTAX
<ie:webject name=Format-Group type=GRP>
  <ie:param name="ATTRIBUTE" data="attribute_name"/>
  <ie:param name="CLASS" data="class"/>
  <ie:param name="FORMAT" data="format_specifier"/>
  <ie:param name="GROUP_IN" data="input_group_name"/>
  <ie:param name="GROUP_OUT" data="output_group"/>
  <ie:param name="LOCALE" data="language"/>
</ie:webject>
PARAMETERS
Required
Select
Optional
ATTRIBUTE
CLASS
FORMAT
LOCALE
GROUP_IN
GROUP_OUT
ATTRIBUTE
Identifies the string of data in a group to be formatted. These define the attributes that are used in creating the GROUP_OUT. Only the attributes explicitly specified in ATTRIBUTE parameters are used in creating the GROUP_OUT.
Multiple values can be specified for this parameter. This parameter is required.
CLASS
Specifies the type of the objects contained in the output group named by the GROUP_OUT parameter. For example if a webject specifies CLASS=MyClassName and GROUP_OUT=data_1, then the XML representation of the output group contains the following tags:
<MyClassName NAME="data_1" TYPE="Object" STATUS="0">
</MyClassName>
The default for this parameter is “Unknown-Class-Name.” This parameter is optional.
FORMAT
Specifies how to format the string of data specified in the ATTRIBUTE parameter. The value of the FORMAT parameter must be acceptable to the Java class java.text.MessageFormat. Each row of the GROUP_OUT has as many attributes as there are FORMAT parameters.
Each FORMAT parameter can include substitution strings that look like {n}, where n is a non-negative integer. These strings are replaced in the GROUP_OUT by the next unconsumed attribute whose offset is defined by n. The offset is relative to the first unconsumed ATTRIBUTE value as of the start of processing of the FORMAT parameter.
For example, if n is 0, the very next unconsumed ATTRIBUTE value is substituted. If n is 1, the second unconsumed attribute value is substituted. If n is 2, the third unconsumed attribute value is substituted, and so on. When the FORMAT parameter has been processed completely, all ATTRIBUTE values substituted by it are marked as consumed.
Multiple values can be specified for this parameter. This parameter is required.
GROUP_IN
Specifies the group to be formatted. This parameter is required.
GROUP_OUT
Specifies the formatted group. This parameter is required.
LOCALE
A string representation of the Java class locale, such as en-US (ISO language name, dash, ISO country code). If not specified, it currently defaults to the default locale defined for the platform on which Info*Engine is running. This parameter is optional.
EXAMPLE
The following example formats data in the current VDB group using substitution strings. The formatted data is placed in an output group named “formatted results” with a specified Java class locale of “en-US”:
<%@page language="java" session="false"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core"
                                               prefix="ie"%>

<!-- Format elements of a group. -->

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

<ie:webject name="Format-Group" type="GRP">
  <ie:param name="GROUP_IN" data="createdgroup"/>
  <ie:param name="ATTRIBUTE" data="NAME"/>
  <ie:param name="ATTRIBUTE" data="EMAIL"/>
  <ie:param name="ATTRIBUTE" data="NAME"/>
  <ie:param name="ATTRIBUTE" data="EMAIL"/>
  <ie:param name="ATTRIBUTE" data="EMAIL"/>
  <ie:param name="ATTRIBUTE" data="NAME"/>
  <ie:param name="FORMAT" data="{0}"/>
  <ie:param name="FORMAT" data="{0}"/>
  <ie:param name="FORMAT" data="Name: {0} lives at {1}"/>
  <ie:param name="FORMAT" data="Email: {0} --- Name: {1}"/>
  <ie:param name="CLASS" data="resultGroup"/>
  <ie:param name="GROUP_OUT" data="formatted results"/>
  <ie:param name="LOCALE" data="en-US"/>
</ie:webject>