
Database Query
Components User's Guide
67
Writing the Database Query Body
The body section of the Database Query component formats the display of the query
results. The component can define unique formatting for each row and field in the result
set, or repeat the same formatting for a series of rows or fields.
query or
queryfile
A SQL query (
SELECT
statement), or the path to a
SQL query file (.sql) in
Collage
Specifies the query to pass to the database. Define this as
either of the following:
query
An inline SQL query statement (
SELECT
statement), for
example:
query="SELECT Name, Position, Age FROM
Employee WHERE Salary > 4000"
queryfile
The path to a SQL query file (.sql) in Collage.
IMPORTANT!
The query must retrieve all of the fields that
you want to display, either from the component itself, or on
linked detail pages. Detail pages do not query for additional
fields; they can only display fields that are already in the
component's result set.
You can also pass a parameter to the query. The example
below shows a query that calls the "CustOrdersDetail" stored
procedure. It also passes the value of a metadata field called
"OrderId" as a parameter.
query="exec CustOrdersDetail
'$node.meta('OrderId')'"
skip
Number Specifies the number of rows that the component will skip
when displaying the query results. The skipped rows begin
with the first row in the query result.
This is useful if, for example, you wish to divide query results
into multiple pages. Each page can contain a Database
Query component, each of which returns a range of specific
records, such as 1-10, or 11-20. Use the
max
property to
define how many records to return, such as 10, and use the
skip
property to define the starting row. For example, to
display records 11-20, set the following values:
max="10"
skip="10"
These values skip the first 10 records to start at record 11,
and limit the total records returned to 10.
Property Value Description
Commenti su questo manuale