Advanced Customization > Info*Engine User’s Guide > Task Webject Reference > Group Webjects > Join-Groups
  
Join-Groups
DESCRIPTION
Joins similar information from two different groups into one group. By setting the JOIN_TYPE parameter to MAX, dissimilar information within both groups is also included in the new group.
* 
The difference between the Join-Groups webject and the Merge-Groups webject depends on how duplicate information is treated. The results of joining groups is that duplicated information is eliminated. Merging groups of data allows duplicates to be preserved.
SYNTAX
<ie:webject name="Join-Groups" type="GRP">="GRP">
  <ie:param name="CASE_IGNORE" data="[TRUE | FALSE]"/>
  <ie:param name="CLASS" data="class"/>
  <ie:param name="COMPARISON" data="[ALPHA | NUMERIC]"/>
  <ie:param name="GROUP_IN" data="input_groups"/>
  <ie:param name="GROUP_OUT" data="output_group_name"/>
  <ie:param name="JOIN_TYPE" data="MAX"/>
  <ie:param name="JOINBY" data="attribute"/>
  <ie:param name="SORTBY" data="attribute"/>
  <ie:param name="SORTED" data="[ASC | DESC]"/>
  <ie:param name="UNDEFINED" data="somevalue"/>
</ie:webject>
PARAMETERS
Required
Select
Optional
GROUP_IN
CASE_IGNORE
GROUP_OUT
CLASS
JOINBY
COMPARISON
JOIN_TYPE
SORTBY
SORTED
UNDEFINED
CASE_IGNORE
Acts as a flag for case. If TRUE is specified, case is ignored. If FALSE is specified, then case is significant. The default for this parameter is FALSE. This parameter is optional.
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.
COMPARISON
Describes how to compare the two groups: either ALPHA for an alpha-numeric comparison, or NUMERIC for a strictly numeric comparison. The default for this parameter is ALPHA. This parameter is optional.
GROUP_IN
Specifies the names of the two groups to be used in computing a join. To specify two group names, you can include two lines with different values for the GROUP_IN parameter. For example:
<ie:param name="GROUP_IN" data="group1"/>
<ie:param name="GROUP_IN" data="group2"/>
The order of the groups listed in the parameter determines the order in which the groups are joined.
This parameter is required.
GROUP_OUT
Specifies the name of the results of computing the join of the two groups. This parameter is required.
JOINBY
Identifies the attribute or column name to be used for comparisons. When a join is performed, an element of the first named group is joined with an element of the second named group if they contain attributes named by the JOINBY parameter(s) with matching values.
If the attributes used for the comparison in both groups have the same name, then include only one JOINBY parameter. If the attributes used for the comparison do not have the same name, then include two JOINBY parameters. The attribute name placed in the output group is the attribute name of the first JOINBY parameter used.
This parameter is required.
JOIN_TYPE
Specifies that a MAX join is to be performed. Without JOIN_TYPE specified, any information that is not similar within the two groups being joined are omitted from the output. When JOIN_TYPE is set to MAX, the webject joins all information from both groups being joined. For fields without values, the UNDEFINED value is used. For more information, see Join-Groups.
This parameter is optional.
SORTBY
Specifies the name of the attribute on which the sorting is done. If you do not include this parameter, the results are not sorted. This parameter is optional.
SORTED
Determines how values in the resulting group are sorted. The attribute named in the SORTBY parameter determines which values are sorted. Specify ASC to sort in ascending order or specify DESC to sort in descending order. The default for this parameter is ASC. This parameter is optional.
UNDEFINED
Sets the value to use if no attribute value exists. The default value for this parameter is "". This parameter is optional.
EXAMPLES
There are two examples for the Join-Groups webject. The first is an example task, and the second supplements the definition of the JOIN_TYPE parameter.
The following example creates two groups and then joins them by the NAME attribute using the Join-Groups webject. It creates an output group named “results” and adds the group to the local output group collection:
<%@page language="java" session="false"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>

<!--Create a group named createdgroup. -->
<ie:task uri="com/company/CreateGroup.xml"/>

<!--Create a group named createdhrgroup. -->
<ie:task uri="com/company/CreateGroupHr.xml"/>

<!-- Form a group by joining two groups -->

<ie:webject name="Join-Groups" type="GRP">
  <ie:param name="GROUP_IN" data="createdgroup"/>
  <ie:param name="GROUP_IN" data="createhrgroup"/>
  <ie:param name="JOINBY" data="NAME"/>
  <ie:param name="JOIN_TYPE" data="MAX"/>
  <ie:param name="SORTBY" data="NAME"/>
  <ie:param name="SORTED" data="ASC"/>
  <ie:param name="GROUP_OUT" data="results"/>
</ie:webject>
This example shows the results of combining Group A with Group B on C3 with the Join-Groups webject. The first two tables show the groups that are joined. Notice that the information in Column 3, Row 3 is not the same in these two groups.
Table 1 Group A
C1
C2
C3
Row 1
a1
b1
c1
Row 2
a2
b2
c2
Row 3
a3
b3
c3
Table 2 Group B
C3
C4
C5
Row 1
c1
d1
e1
Row 2
c2
d2
e2
Row 3
c4
d4
e4
Assume that the following webject executes:
<ie:webject name="Join-Groups" type="GRP">
  <ie:param name="GROUP_IN" data="Group A"/>
  <ie:param name="GROUP_IN" data="Group B"/>
  <ie:param name="JOINBY" data="C3"/>
  <ie:param name="GROUP_OUT" data="Results"/>
</ie:webject>
Table 3 Results Without the JOIN_TYPE Parameter
C1
C2
C3
C4
C5
Row 1
a1
b1
c1
d1
e1
Row 2
a2
b2
c2
d2
e2
This webject does not use the JOIN_TYPE parameter. Notice that the columns from Group A precedes the columns from Group B and that information from Row 3 in Groups A and B is not included.
<ie:webject name="Join-Groups" type="GRP">
  <ie:param name="GROUP_IN" data="Group A"/>
  <ie:param name="GROUP_IN" data="Group B"/>
  <ie:param name="JOINBY" data="C3"/>
  <ie:param name="JOIN_TYPE" data="MAX"/>
  <ie:param name="GROUP_OUT" data="Results"/>
</ie:webject>
The result when the JOIN_TYPE parameter is specified is shown below. All rows of information are included.
In this example, Group A (which had values for Row 3 in C1, C2, and C3) has those values included in Row 3. Group B (which had values for Row 3 in C3, C4, and C5) has those values included in Row 4. The default value that is included for information that is dissimilar between the groups is "".
Table 4 Results With the JOIN_TYPE Parameter
C1
C2
C3
C4
C5
Row 1
a1
b1
c1
d1
e1
Row 2
a2
b2
c2
d2
e2
Row 3
a3
b3
c3
""
""
Row 4
""
""
c4
d4
e4
Joining Group B with Group A results in the same data joined in a different order. The C3 column is derived from Group B. Data from Group B is first, followed by the data from Group A. If Group B is joined with Group A, you get the following:
Table 5 Results With the JOIN_TYPE Parameter
C3
C4
C5
C1
C2
Row 1
c1
d1
e1
a1
b1
Row 2
C2
d2
e2
a2
b2
Row 3
C3
""
""
a3
b3
Row 4
C4
d4
e4
""
""