Advanced Customization > Info*Engine User’s Guide > Info*Engine Custom Tag Reference > Info*Engine Tags > Core Library Tags > getValue
  
getValue
The getValue tag retrieves the string value of the specified attribute from the first element in the input group.
This tag can be nested in other Info*Engine tags.
Do not imbed this tag in scriptlets; doing so causes a compiler error because the tag is read as plain text. For example, the following scriptlet does not compile:
<%
float total = 0;
%>

<ie:forEach ...>
<% total += <ie:getValue name="SAL"/>;%>
</ie:forEach>
Instead, within a scriptlet you can use the getAttributeValue method. For an example that uses this method, see the “Examples” section below.
Syntax
<ie:getValue name="attr_name" groupIn="group_name"/>
Attribute Descriptions
Required Attributes: name
groupIn
Specifies the name of the Info*Engine group to use as the input group.
This attribute is optional. If you omit this attribute, the last group added to the VDB is used.
name
Specifies the name of the attribute whose value you want to retrieve from the first element in the Info*Engine input group.
This attribute is required.
Examples
The following example declares that the page uses tags from the Info*Engine core tag library and that the tags have the ie prefix. The example assumes that the “employees” group exists as a result of a “CreateEmployeesGroup” task. The getValue tags are nested within table HTML tags, producing values for elements in the table rows that are displayed.
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie" %>

<!-- create input group -->
<ie:task uri="CreateEmployeesGroup"/>

<!-- iterate group, displaying the salary for one employee -->
<!-- in each iteration -->
<table>
<tr><td>Employee Name</td><td>Salary</td></tr>
<ie:forEach groupIn="employees" groupOut="employee">
<tr>
<td><ie:getValue name="ENAME"/></td>
<td>$<ie:getValue name="SAL"/></td>
</tr>
</ie:forEach>
</table>
The following example page uses the getValue tags to display selected attributes in each element and uses a scriptlet to calculate a running salary total. Computing the salary total uses the Info*Engine getAttributeValue method:
<%@page language="java" session="false" errorPage="../IEError.jsp"

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

<!-- create a group that contains employee name, number, and salary -->
<ie:task uri="CreateEmployeesGroup"/>

<html>
<body>
<ie:getService varName="pie"/>
<% float tot_sal = 0; %>

<!-- iterate group, displaying the salary for one employee -->
<!-- in each iteration and calculating the total salary -->
<ie:forEach groupIn="employees" groupOut="one-element">
<b>Employee Number</b>:<ie:getValue name="EMPNO"/><br>
<b>employee name:</b><ie:getValue name="ENAME"/><br>
<b>salary:</b>$<ie:getValue name="SAL"/><br>
<hr><br>
<%
String ssal = pie.getAttributeValue ( "one-element", 0, "SAL" );
tot_sal += Float.parseFloat ( ( (ssal != null && !ssal.equals(""))
? ssal :
"0" ) );
%>
</ie:forEach>
<!-- Display the salary total for all employee in the group -->
<b>Salary Total:</b>$<%=tot_sal%><br>

</html>
</body>