Expression Elements Dialog

Top  Previous  Next

 

The Expression Elements dialog is used to look up and select elements to insert in expressions.  All available functions, data fields, pick lists, operators and other expression elements can be found here.  This dialog is primarily invoked from the Insert Expression Element button on the Expression Creator dialog, but is also accessible from similar buttons on dialogs that have an expression editing window built in, such as Edit Query Column and Edit Macro Definition.

 

When inserting an expression element, remember that any text selected in the expression editing window will be replaced with the element you select here.  A prompt will warn you of this, so you can go back and clear the text selection if necessary.

 

There are three lists in the dialog, which are used for looking up an expression element in a hierarchical fashion.  

 

First select the general kind of element in the first column, such as Function, Main Table Field, Pick List Value, Macro, or Operator.

 

The other two columns will change depending on what you've chosen -- use the second column to narrow down your choice more, for instance by Function Type needed, or which Table you need the field for, or whether you need a Macro or Script, or which Pick List you need a value for.

 

Finally, select the element in the third column, for instance the Field Name, Pick List Value, or Operator.

 

You'll notice when selecting an element that two windows will show information at the bottom.  This information varies slightly depending on what kind of element is selected.  Also note that what's actually inserted in the expression when you click Insert will depend on the kind of element.

 

 

Functions

 

All functions are shown by default (with "<All>" selected in the Function Type list), but you can narrow your search by selecting the Function Type of interest.  Note that some functions will appear in more than one list, if it fits in more than one category.

 

The Return type and the Arguments needed for the function are shown in the first line, and a description of the function is shown below.  Note that optional arguments are shown in brackets.  These brackets may be nested -- for instance if it shows nVal [,nVal2 [,nVal3 ]], that means the function could take one, two, or three values, and that nVal3 cannot be present without nVal2 also being present.  As a general rule, arguments can never be skipped over -- to include an optional argument later in the list, all previous arguments must also be included.

 

When the Insert button is used to select a function for an expression, it inserts the function name and the required parenthesis, and also the argument list.  This reminds you what arguments are needed, and then you can replace each argument as needed.

 

Note that the first letter of an argument indicates the type of argument needed (this is similar to what's called Hungarian notation, though it doesn't follow exactly the same rules as other programming languages).

 

 n = Number

 d = Date

 b = Boolean (true or false, specifically .T. or .F.)

 c = Character, or Text, e.g. in quotes

 e = Expression (may have various result types)

 r = Record of the database, like a Customer record

 

You may notice that there are some duplicate functions -- two different function names that do the same thing.  The main reason for this is to provide shortcuts for some functions are used frequently.  For instance, ThisResv() can also be used as Resv(), and ThisRecord() can also be used as simply This().

 

A description of each function can be seen when the function is selected in the Expression Elements dialog, but you can also refer to a Function Reference here if you want to browse the functions for each category.

 

 

Main Table Fields

 

This shows the five main tables that are most likely to be used, and all fields for the selected table are listed (only the fields that are enabled).  The fields are in alphabetical order by the Field Name (according to Data Field Definitions).

 

The field's Description will be shown in the line below the selection lists, and the large window will show the shortcut field identifier that will be inserted into the expression.  This is a 4-letter table abbreviation and the field ID, separated by colons.

 

Important:  The shortcut field identifier is only valid if the context of the expression will have a "This" field of the selected table type -- e.g. if the base table is Reservations, then "Resv" is valid.  If the base table is Customers, then "Resv" is probably not going to work.

 

 

All Table Fields

 

This shows all tables in the database (excluding pick list tables), and all fields for the selected table are listed (only the fields that are enabled).  The fields are in alphabetical order by the Field Name (according to Data Field Definitions).

 

The field's Description will be shown in the line below the selection lists.  The large window will show what will be inserted into the expression when Insert is used.  This is generally a FieldText function to get the text of that field, using FindRecByRecID function to get a record of a known Record ID.  This is just an example -- many times you can replace TableRecAt with a more appropriate function according to the context (e.g. ThisListRec).  You may also want to use FieldValue instead of FieldText.  The important thing is that it gives you the field name and the table name if needed, so you know how to get that field.

 

 

Pick List Fields

 

This shows all pick lists in the database, and the "fields" available for the pick list selected.  The fields are in alphabetical order by the Field Name (according to Data Field Definitions).  Otherwise it works like All Table Fields above.

 

 

Pick List Values

 

This also shows all pick lists, but instead of showing the fields it shows the Selection Names of all of the current pick list items.  This is generally used if you're creating an expression to compare a pick list field value to one of the items in the list.

 

The numeric value will be shown in the first line at the bottom (which is actually the pick list item's record ID), and the pick list text will be shown in quotes below that.  The text in quotes will be inserted into the expression, but you might want to use the numeric value in some cases (it may be faster to compare values than text, and isn't as likely to change as the text).

 

 

Fixed List Values

 

This works like the Pick List Values, but it shows all of the selection lists in the program that can't be changed like the Pick Lists. The most commonly used of these are the Reservation Status and Transaction Types.  

 

 

Macros & Scripts

 

This allows you to select one of the built-in Macros, or a Macro or Script that you've defined yourself.  When a Macro is selected, the windows below show the description (as defined in the Macro), and the complete Macro expression.  When a Script is selected, only the description is shown.

 

When one of these is Inserted, it will also include the "Macro( )" or "CallScript( )" function call with the Macro or Script name filled in.  In the case of a Macro, it will also include place holders for any arguments needed for the Macro.

 

 

Operators

 

This shows a list of valid operators of the selected type, and will show a description of the selected operator.  Inserting an operator simply inserts the operator, with spaces around it.  Spaces aren't usually required, but it makes the expression easier to read.

 

 

 

Additional Topics:

 

Expressions Overview

Expression Syntax

Expression Context

Expression Processing

 

Expression Creator Dialog

 

Function Reference

 

Macro Expressions

 

Scripts

 

Color Schemes

 

Queries

 

Forms

 

Advanced Customizations Overview & other topics

 

 


Page URL http://CampgroundMaster.com/help/expressionelements.html

Campground Master Home