Expression Context

Top  Previous  Next

 

Expressions wouldn't be very useful if they operated in a vacuum, without any knowledge of what they're being used for.  For instance on a receipt form, you couldn't use an expression to show the customer's name unless you know which customer you're printing the receipt for.

 

Expression "context" solves this problem by giving the expression processor as much information as possible about what the expression is being used for and what information is already known.  This information is accessible through a number of "context" functions, or "This" functions.  

 

The applicable information varies depending on the situation, but you can use the various "This" functions to get what's available.  For instance in a list query's data expression, you can get the date range being requested for the query (ThisFromDate and ThisToDate), the base table of the query (ThisTable), and the specific record of the data line that the expression is being asked to fill (ThisRecord, or in some cases ThisResv, ThisCust, ThisSite, etc.).

 

Note that the ThisRecord function (or is short equivalent, This) is the generic form to get the current record in context.  The record it returns could be any "type" of record, depending on the situation.  This may be appropriate in general cases such as just checking for a valid record, e.g. This() != NullRecord(), or where there isn't a more specific function available.  However in a case where you need a specific record type, such as a function to get a field from the record, you should use the more specific function like ThisCust or ThisResv whenever possible.  This is especially true in Forms, where a single form may be useful in the context of Reservations, Customers, or even Sites.  Using the specific context function allows you to easily create a copy of a Customer-based form and change the Base Table to "Reservations" so it can be used for reservations as well.

 

Refer to the applicable sections to find out which context variables are available in each situation.

 

 

 

Additional Topics:

 

Expressions Overview

Expression Syntax

Expression Processing

 

Expression Creator Dialog

Expression Elements

 

Function Reference

 

Color Schemes

 

Queries

 

Forms

 

Advanced Customizations Overview & other topics

 

 

 


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

Campground Master Home