Constructs an RQL query and renders its output parameter once for each element returned by the query.

Class Name

atg.repository.servlet.NamedQueryForEach

Component

/atg/dynamo/droplet/NamedQueryForEach

Required Input Parameters

queryName

The name of the query to execute.

repository

The Nucleus path of the repository to query.

itemDescriptor

The name of the item type to query.

Optional Input Parameters

input Params

A comma-delimited list of values for each parameter that is required by the query. To supply the value of a request parameter, use the syntax :param-name.

transactionManager

The transaction manager to use. For example:

<dsp:param name="transactionManager"
  bean="/atg/dynamo/transaction/TransactionManager"/>

sortProperties

Holds a string that specifies the order to render array items. For more information on using this parameter, see ForEach.

Output Parameters

index

The zero-based index of the returned row.

count

The one-based number of the returned row.

element

A dynamic bean that has properties for accessing the values returned in the result set. To return a particular property value for each item in the result set, use the convention element.name, where name is any property name supported by the item descriptor.

size

Set to the number of returned rows.

key

The current key if the array is a Dictionary.

repositoryException

If a RepositoryException is thrown, set to the exception.

Open Parameters

The following open parameters control the formatting for the returned results:

output

Rendered once for each returned row.

outputStart

Rendered before any output tags if the array of returned rows is not empty.

outputEnd

Rendered after all output tags if the array of returned rows is not empty.

empty

Rendered if the array contains no rows.

error

Rendered if there is an error when the query executes.

Usage Notes

NamedQueryForEach executes a named RQL query and renders its open parameter output once for each element returned by the query. The behavior of this servlet bean is identical to RQLQueryForEach; it differs only in its use of the required input parameter queryName, which is used together with the input parameters repository and itemDescriptor to specify a named query.

In the following code fragment, queryName refers to a named query that is already set up in the specified repository. The bikePromotion value supplied to input parameter inputParams matches a parameter in that query, and is set to the value of request parameter startDate:

<dsp:droplet name="/atg/dynamo/droplet/NamedQueryForEach">
   <dsp:param name="startDate" bean="CurrentDate.dateAsTime"/>
   <dsp:param name="repository"
      value="/atg/userprofiling/ProfileAdapterRepository"/>
   <dsp:param name="itemDescriptor" value="user"/>
   <dsp:param name="queryName" value="getPromotionsByNameQuery"/>
   <dsp:param name="inputParams" value="bikePromotion, :startDate"/>
   <dsp:param name="transactionManager"
      bean="/atg/dynamo/transaction/TransactionManager"/>
...

Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices