The Expression Builder is a tool that lets you easily create SilverStream expressions.
This chapter is organized as follows:
For an overview of expression in SilverStream, see Using SilverStream Expressions in the Programmer's Guide.
For more information about the expression language, see Expressions, operators, and built-in functions in the online General Reference.
You use the Expression Builder to easily create SilverStream expressions. You invoke the Expression Builder from the Properties dialog in the Designers.
The Expression Builder contains three panes: Variables, Operators, and Functions.
For complete information on the SilverStream operators and built-in functions, see Expressions, operators, and built-in functions in the online General Reference.
Building the expression
You can type the expression in the text box at the bottom or paste in columns, fields, operators, and built-in functions by selecting them from the lists.
When you paste in a built-in function, its syntax--including parameters--is pasted in for you; replace the place-holders with variables.
You can click the Verify button any time to check your expression's syntax.
Types of expressions
The following sections describe how to use the Expression Builder to build different types of expressions.
You can specify the data you want retrieved when first creating a form, page, or view using the Form, Page, or View Wizard.
Default behavior
When you specify data in a Wizard, the "no automatic query" option is selected bey default. This means that no data is sent to the client until the client initiates the query() with a specific request.
If you select any other option, like "go to first record", all rows are retrieved and will be sent to the client. If you are working with large tables, you will want to refine the query to return only specified rows.
Refining the default query
You can use the Expression Builder to refine the query in the Form, Page, or View Designer after creating the object.
You can specify the following components of a query:
The Expression Builder displays.
The primary table is listed in the Variables box. Click + to expand the display to list all columns. Also, any tables related to the primary table are listed. You can pick columns from these tables to include in your query.
For information about relationships between tables, see Relationship Designer.
NOTE You can include any of the listed columns in your query; the column itself does not need to be retrieved in the form, page, or view to participate in the query.
For complete information on the SilverStream operators and built-in functions, see Expressions, operators, and built-in functions in the online General Reference.
Examples
Here are some examples of a page, form, or view that retrieves employee information:
The Expression Builder displays.
The Expression Builder displays.
Typically, you will simply specify a column to sort by, but you can specify any expression and use any of the listed built-in functions to sort rows by.
You can also construct a query programmatically using the query()
method. When you create a page, form, or view in the SilverStream Designer, this method is included with the AgData helper class.
Use the query()
method to specify a WHERE clause and an ORDER BY clause at runtime.
Both parameters are optional. If you don't specify a WHERE clause, all rows are retrieved. If you don't specify an ORDER BY clause, the rows are retrieved in indeterminate order.
Example
The following statement retrieves all employees in department 300, sorted by last name.
myView.query("employees.deptid=300", "employees.lastName")
You can use the Expression Builder to create your own full-text search expressions. The SilverStream full text search feature is based on ANSI SQL, which is the standard interface language for accessing databases. SQL provides language extensions that support text retrieval. The combination of the queries you create in SilverStream and the search engine provided by Fulcrum enables you to:
You can create a number of different searches. You can:
For more information, see Full Text Search.
SilverStream supports both server-side and client-side validation of data. You can use the Expression Builder to:
For more information, see Creating validation rules for tables in the Table Designer section of the Tools book in the help system.
For more information, see Creating validation rules for form fields.
For more information, see Creating validation rules for page fields.
NOTE You can specify more complex validation tests in forms and pages by writing Java code (and, in the case of pages, JavaScript). For more information, see the Programmer's Guide.
You can use the Expression Builder to build security expressions, which are expressions that specify who is able to access specific SilverStream objects, including data and application objects. For example, you can specify permissions such as the following:
For more information, see setting up access control in the Administrator's Guide.
You can use the Expression Builder to create Link expressions, which let you pass query information and parameters from one page to another.
For more information, see Creating a Link expression.
You can use the Expression Builder to create aggregate expressions, which specify summary statistics in views.
For more information, see Creating aggregates