SEARCH:
  Next: androPage Smarty

androPage YAML Specifics

The androPage system reduces the amount of code that you need to write (and maintain) by replacing code with a simple data file. A single data file can be used to produce output in several useful forms.

The data file describes three fundamental things:

  • Which values you want from the datbase, i.e, which table columns.
  • What filters you need supplied from the user
  • Various Options

We will now see what you can provide for these. Here is the example we will work with:

options:
    title: Customer Report
    
table customers:
    column customer:
    column description:
    column amt_order:
        compare: between @amt1 and @amt2
    column amt_paid:
    column amt_balance:
    
uifilter amt1:
    type_id: numb
    colprec: 10
    colscale: 2
    description: Minimum Balance
uifilter amt2:
    type_id: numb
    colprec: 10
    colscale: 2
    description: Maximum Balance    

File Name and Format

The file should be named --name--.page.yaml, and should be in your application directory. Links can reach the page by specifying the parameter "gp_page", as in "index.php?gp_page=myexample". The link should not specify the ".page.yaml" part.

The One Option: Title

As of this writing, March 2008, there is only one option, which is the page's title.

options:
    title: Customer Report

Filters

androPage requires at least one filter. Each filter is specified as "uifilter --name--:". You must supply a type_id at least, and for numerics and characters a colprec (column precision, i.e., size). A description is also required.

uifilter amt1:
    type_id: numb
    colprec: 10
    colscale: 2
    description: Minimum Balance
uifilter amt2:
    type_id: numb
    colprec: 10
    colscale: 2
    description: Maximum Balance    

The Tables and Columns

The heart of each androPage YAML file is a list of tables and columns. Here are the basic ideas to keep in mind when you specify tables and columns:

  • You can list multiple tables.
  • If you list multiple tables, Andromeda will automatically work out the JOIN conditions based on the foreign keys, but all tables must "touch" each other through foreign keys.
  • You can list any number of columns per table, as much as are practical.
  • If you list multiple tables you do not need to put them in any particular order.

All of the options available here apply to columns. You can specify the following options for a column:

  • uino: Means do not display on the output. Used when you need to filter on a column that will not actually be displayed.
  • descrpition: By default the column's description is taken from the data dictionary, but you can override that by specifying a description for the column.
  • compare: Enter any valid SQL comparison. Refer to the filter columns with an "@" sign, so you might have "compare: > @date1".
  • dispsize: by default the display size is taken from the data dictionary. If you supply one here it will override the default.
  • group: sum or group: avg. If you specify this, then this value will be summed or averaged. The GROUP BY clause is automatically generated as every column that has no group: function.

This early version of androPage has a problem with the ORDER BY feature, it is not yet working.

  Next: androPage Smarty