Skip Headers
Oracle® Application Express End User's Guide
Release 4.2

E35124-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to current chapter
Up
Go to next page
Next
PDF · Mobi · ePub

2.13 Understanding Markup Syntax

This section describes syntax for adding links to Websheet pages, page sections, external URLs, data grids, or for including SQL or SQLVALUE syntax.

Tip:

A Help button displays in the upper right corner of each Websheet page. The Help page, Markup Syntax, lists all the different syntax options described in this section.

Topics:

2.13.1 Linking to a Page

To include links in page sections to other pages in a Websheet, use the syntax described below. If the page exists, a link displays. If the page does not exist, a link to create the page displays. Note that the use of the page: identifier is optional.

Syntax:

[[ page: <page alias> | <link name> ]]
[[ <page alias> | <link name> ]]

Syntax Example:

[[page: home]] 
[[mypage | My Page]]

In Context Example:

One of the most colorful fish is the [[ clownfish | Clown fish]].

2.13.2 Linking to a Section

To include links to a page section, use the syntax below. If the section exists, a link displays. If the section does not exist, a link to create the section displays. Note that if the section is not prefaced by a page, it is assumed the section is on the current page.

Syntax:

[[ section: <page alias> . <page section> | <link name> ]]
[[ section: <page section> | <link name> ]]

Syntax Example Linking Within the Current Page:

[[section: clownfish | Clown Fish]] 

Syntax Example Linking to a Different Page:

[[section: fish.clownfish | Clown Fish]] 

In Context Example:

One of the most colorful fish is the [[ section: clownfish | Clown fish]].
Visit or fish page to see the [[ section: fish . clownfish | Clown fish]], also known as Nemo.

2.13.3 Linking to External URLs

To include links to external URLs in page sections, use the syntax below. Note that the use of the url: identifier is optional. To have the link open in a new browser window, use the popup prefix.

Syntax:

[[ url: <url> | <link name> ]]
[ popupurl: <url> | <link name> ]]
[[ <url> | <link name> ]]

Syntax Example:

[[url: http://www.company.com/store | commpanystore]]
[[popupurl: http://www.company.com/store | commpanystore]]
[[http://www.searchengine.com | searchengine]] 
[[http://www.searchengine.com ]] 

In Context Example:

You can buy Company software on the [[http://www.company.com/store | Company Store]] website.

2.13.4 Linking to a Data Grid

To include links to data grids within page sections, use the syntax below. You can use these links to view the data grid or to create new data. Note that data grid can be one or two words.

Syntax:

[[ data grid: <datagrid alias | <link name> ]]
[[ datagrid: <datagrid alias | <link name> ]]
[[ datagrid: <datagrid alias . <saved report name (may not be private)> | <link name> ]] 

Syntax Example:

[[ data grid: todo list | To Do List ]]
[[ data grid: todo list . open todo items | To Do List ]]
[[ datagrid: todo list | To Do List ]] 

In Context Example:

Please review the [[ data grid: todo list | To Do List ]] and ensure your tasks can be accomplished by Friday.

2.13.5 Using SQL and SQLVALUE Syntax

By using SQL or SQLVALUE syntax, you can include single value and tabular results of queries against data grids or tables and views within sections of a page. The SQLVALUE tag displays the first column of the first row returned by the SQL query. Use this syntax to embed data within a sentence (for example: There are currently 5 types of cats.). For tabular results, use the SQL tag. Using SQL tag produces a searchable report. However, you can disable the search option by using the NOSEARCH syntax.

When working with data grids, there are a few more options (shown under Syntax) and a few more rules. Basic rules when writing a data grid query include:

  • Enclose the data grid name or data grid alias with braces. For example:

    {Cat Facts}
    
  • Enclose the data grid column names with double quotation marks. For example:

    "Type of Cat"
    

To learn more about advanced rules, see "About Advanced Data Grid Queries Rules".

Syntax for Queries Against Tables and Views:

[[sql: <select statement> ]]
[[sql: <select statement | limit="<maximum rows>" nosearch style="<style number>" ]]
[[sqlvalue: <select statement> ]]

Syntax for Data Grid Queries:

[[sql: <select statement> ]]
[[sql: <select statement | limit="<maximum rows>" nosearch style="<style number>" edit_row add_row show_sql ]]
[[sqlvalue: <select statement> ]]
[[sqlvalue: <select statement> | show_sql ]]

In Context SQL Tag Syntax Examples:

[[sql: select ename "Employee Name", sal "Salary" from emp order by sal desc | limit="10" style="2"]].
[[sql: select "Type of Cat",
              "Estimated Population",
              "Largest Threats",
              "Top Speed",
              "Scientific Name",
              "IUCN Status",
              "Weight",
              "Study Date"
       from {Cat Facts} | add_row edit_row ]]

In Context SQLVALUE Tag Syntax Examples:

We have [[sqlvalue: select count(*) from emp]] employees in our database, 
[[sqlvalue: select count(*) from emp where deptno=10 ]] work in department 10.
We are currently tracking [[sqlvalue: select count(*) from {Cat Facts} ]] 
types of cats.

2.13.6 About Advanced Data Grid Queries Rules

Advanced data grid query rules include:

  • The query must reference the data grid only once to include an edit or add row link (that is, you cannot join the data grid to itself within the query).

  • The first column must be the primary key of the data grid to include an edit row link (that is, the column that uniquely identifies the row of data). If the "edit_row" option is included and the query has a single select statement, the primary key column is included automatically. If the query contains multiple select statements, you can use the "APXWS_DATA_GRID_PK" substitution (always enclosed with double quotation marks) as the first column in the SELECT statement to include the primary key to include an edit row link.

  • Report column names are the column name from the data grid, but can be modified using standard SQL column aliasing syntax. For example, the following displays the data from the Minimum Number column but the heading displays as Min:

    select "Minimum Number" "Min" from ...
    
  • If a column name is longer than 30 characters, you only include the first 30 characters as the name. For example, use:

    "% of Estimated Lions per Region"
    

    Instead of:

    "% of Estimated Lions per Region"
    
  • To display the query that is executed, include the "show_sql" option. By including this option, the query displays above the included report. Although this is a good approach for debugging, Oracle does not recommend "show_sql" for a production application.