Query-Attributes
Description
Returns all unique records that match the specified query criteria. The records come from the specified table. If duplicate values exist, then the duplicate value is returned only once.
Syntax
<ie:webject name="Query-Attributes" type="OBJ">
<ie:param name="ATTRIBUTE" data="attribute"/>
<ie:param name="BLOB_COUNT" data="number_of_BLOBs"/>
<ie:param name="CLASS" data="class"/>
<ie:param name="CONNECTION_ATTEMPT_INTERVAL" data="interval"/>
<ie:param name="CONNECTION_ATTEMPTS" data="attempts"/>
<ie:param name="DBUSER" data="dbuser_name"/>
<ie:param name="GROUP_OUT" data="group_out"/>
<ie:param name="INSTANCE" data="instance"/>
<ie:param name="MAX_QUERY_SIZE" data="max_query_size"/>
<ie:param name="PASSWD" data="dbpassword"/>
<ie:param name="SORTBY" data="sortby"/>
<ie:param name="SORTED" data="[ASC | DESC]"/>
<ie:param name="WHERE" data="where_clause"/>
</ie:webject>
Parameters
Required
Select
Optional
CLASS
SORTBY
ATTRIBUTE
INSTANCE
SORTED
BLOB_COUNT
WHERE
CONNECTION_ATTEMPTS
CONNECTION_ATTEMPT_INTERVAL
DBUSER
GROUP_OUT
MAX_QUERY_SIZE
PASSWD
ATTRIBUTE
Specifies which attributes from the queried object to return. The default for this parameter is to return all attributes. Multiple values can be specified for this parameter. This parameter is optional.
BLOB_COUNT
Specifies how many BLOBs to deliver to the webject. Specifying a value of 0 results in no BLOBs being delivered. Specifying a value of more than 0 results in up to that specified number of BLOBs being delivered. For example, if this parameter is specified with a value of 5, then no more than five BLOBs are delivered to the webject.
The default behavior for this parameter is that all remaining BLOBs are delivered to the webject. This parameter is optional.
CLASS
Specifies which SQL-related table you want to query. This parameter is required.
CONNECTION_ATTEMPTS
Defines the maximum number of times to attempt establishing a connection to an adapter before returning an error. The default value is 1. This parameter is optional.
If multiple INSTANCE parameter values are specified, the value of CONNECTION_ATTEMPTS defines the maximum number of times to iterate through the list of adapter instances.
CONNECTION_ATTEMPT_INTERVAL
Defines the amount of time, in seconds, to delay between connection attempts. The default value is 60 seconds. This parameter is optional.
If multiple INSTANCE parameter values are specified, the value of CONNECTION_ATTEMPT_INTERVAL defines the number of seconds to wait between the attempts to iterate through the entire list of adapter instances.
DBUSER
Specifies the name to use when logging in to the data repository. If this parameter is specified in this webject, the webject value takes precedence over any value specified in the credentials mapping settings or in the adapter LDAP entry. If this parameter is not specified here, it must be specified in the credentials mapping settings or in the adapter LDAP entry. For more information about credentials mapping, see the section Credentials Mapping.
GROUP_OUT
Identifies the group returned by the webject. This parameter is optional.
INSTANCE
Specifies the name of the adapter that executes the webject. Adapter names are defined when the adapter is configured for use in your Info*Engine environment. This parameter is required.
In order to provide the ability to connect to other adapters if a specific adapter is not available, this parameter can be multi-valued. Info*Engine attempts to connect to the adapters in the order given. If the first adapter specified is not available, the next adapter listed is tried, and so on, until a connection is made. If a connection cannot be established with any listed adapter, an error is returned.
In conjunction with this parameter, you can include two other parameters: CONNECTION_ATTEMPTS and CONNECTION_ATTEMPT_INTERVAL.
MAX_QUERY_SIZE
Specifies the maximum number of objects returned from a database query. The default for this parameter is 2000. If there are more than the maximum number of objects, the JDBC driver silently drops the extra objects. This parameter is optional.
PASSWD
Specifies the password to use when logging in to the data repository. If this parameter is specified in this webject, the webject value takes precedence over any value specified in the credentials mapping settings or in the adapter LDAP entry. If this parameter is not specified here, it must be specified in the credentials mapping settings or in the adapter LDAP entry. For more information about credentials mapping, see the section Credentials Mapping.
SORTBY
Defines the attribute names to be used as the sort parameters. Multiple values can be specified for this parameter. Attributes are sorted in the order in which each SORTBY parameter appears in the webject. If no values are specified for this parameter, no sorting occurs. If SORTED is specified, then one SORTBY parameter should be specified for each occurrence of the SORTED parameter.
SORTED
Describes how to sort the attribute names specified in the SORTBY parameter. Valid values are ASC for ascending and DESC for descending. For each occurrence of this parameter, one SORTBY parameter should also be specified. The default value for this parameter is ASC.
WHERE
Specifies search criteria for the database objects to return. The value for this parameter is specified as an SQL-formatted where clause. This parameter is required.
Example
The following example documents QueryAttributes.jsp located in the Windchill installation directory:
codebase/infoengine/jsp/examples/JDBCAdapter/examples
In this example, the database is queried for unique values of the DEPTNO attribute of the EMP table. The results are sorted in descending order, and are displayed using the Display-Table webject.
* 
To run this example on your own system, you need to replace the value of the INSTANCE parameter with a value appropriate to your installation.
<%@page language="java" session="false"
errorPage="IEError.jsp"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie"%>

<html>
<head><title>Query-Attributes Webject</title>
<BASE>
</head>
<body>

<h1>Query-Attributes webject:</h1>
<h3> Based on specified query criteria, returns a set of
distinct records from a table</h3>

<ie:webject name="Query-Attributes" type="OBJ">
<ie:param name="INSTANCE" data="${@FORM[]instance[]}"
default="jdbcAdapter"/>
<ie:param name="ATTRIBUTE" data="${@FORM[]column[]}"
default="DEPTNO"/>
<ie:param name="SORTBY" data="DEPTNO"/>
<ie:param name="SORTED" data="DESC"/>
<ie:param name="CLASS" data="${@FORM[]table[]}"
default="EMP"/>
<ie:param name="WHERE" data="()"/>

<ie:param name="GROUP_OUT" data="QueryAttribute"/>
</ie:webject>

<ie:webject name="Display-Table" type="DSP"/>

</body>
</html>
这对您有帮助吗?