Color Schemes

Top  Previous  Next

 

 

NOTICE:

 

These features are considered to be advanced development tools built in the program and are documented sufficiently for an experienced programmer or someone proficient with database design.  Some sample forms and reports are provided which can be used as-is, modified for your needs, or studied as examples.

 

Our normal technical support will answer basic questions about the capabilities of these functions, but we cannot explain detailed examples or provide training for expressions programming, or debug changes that you've made.  It can take some time to learn the details of these functions, even for experienced programmers, since they use a unique "language".

 

 

A Color Scheme is a set of rules used to determine the color of an item in a grid or an indicator on the map view.  It can define the specific conditions for any number of foreground / background color combinations.

 

There are several places where color schemes are used.  Primarily they're used for the color of data in Query columns, but they can also be used for special coloration of the heading rows or columns of Queries or on the standard tab views like the Rack.  A color scheme can be used to add custom color combinations to the standard colors used on the Rack (and other tab views where a reservation name is shown), or on the Map.

 

 

Color Scheme Setup

 

To create a Color Scheme, go to Maintenance / Advanced Customizations / Color Schemes.  This opens the Color Schemes Setup dialog, which lists all current schemes and has the typical functions for adding, editing, etc.  Note that while there are functions to Move Up and Move Down, a scheme's position in the list does not affect any other functionality except for the order they will appear in selection lists -- it's mainly for your own preferences.

 

You can also Export one or more schemes to a text file, or Import schemes.  This is primarily for you to import Color Schemes created by the software provider, though it can also be used to transfer schemes between multiple databases.

 

Some sample Color Schemes are included with Campground Master, which you can use or learn from (some may also be used in sample Queries).  Click the Import schemes button, and you'll get a typical Windows file dialog labeled "Import Color Schemes".  You need to locate the samples folder, which is typically in C:\Program Files (x86)\Campground Master\Samples (most likely you just need to double-click the "Samples" folder to get there).  Now select the appropriate "Sample Color Scheme" file, and click Open.  Once the sample is imported, you'll see it appear in the list.

 

Note that the import/export files use the "CSV" file extension (e.g. Sample.csv), which means it's a comma-separated-value text file. Windows may recognize this file extension as something another program can open like Excel, but these are in a special format for importing records to Campground Master and should not be used in other functions.  Also avoid opening different kinds of samples which use the same extension (e.g. don't open a Form sample from an Import Script function).

 

 

Color Scheme Names

 

Note that Color Schemes cannot have duplicate names. If you make a Copy, text will be added to the name to make it unique.  Color Scheme names are not case-sensitive.

 

Also note that even though Color Schemes are usually selected by name, for instance when defining a Query, the record link to the scheme is used to reference it internally.  Thus you can change the names of schemes already in use without affecting any function that uses the scheme.  However this also means that a scheme that's already in use (linked from a Query) cannot be deleted.

 

 

Editing Color Schemes

 

To edit a Color Scheme, use the Add or Edit functions in the Color Scheme Setup dialog.  Other functions where schemes are referenced, such as the Global Color Schemes function, have buttons to directly edit the scheme without leaving that function and going through Color Scheme Setup.

 

When editing a scheme, an Edit Color Scheme dialog is shown with each Color Rule of the scheme (each rule being a single expression and the colors represented), along with a place to enter the Color Scheme Name, and an optional Default Scheme.

 

Creating a Color Scheme is simply a matter of adding Color Rules.  Of course you can Insert rules, move and copy rules, etc. as needed.  When a rule is Added or Edited, the Edit Color Scheme Rule dialog will be used to enter the details.

 

Default Scheme

 

The Default Scheme is used to help define how the color scheme will be used.  Think of it as an add-on scheme to either Reservation colors, Open Site colors, or a standalone scheme ("None" for the default).  

 

If you're creating a color scheme to be used for reservations on the Rack, for instance, select "Reservations" as the default scheme.  It will not only have the Resv() context available for your rules expressions so you can check reservation conditions.  Also, after checking the rules in your scheme, it will also use the colors already defined in the Reservation Color Key for any conditions that don't match one of your rules.

 

If you're creating a color scheme to use for open (unoccupied) sites on the Rack, select "Open Sites" for the default scheme.  It will make the Site() context available, and check the open site colors after checking your rules.

 

The "None" default scheme would be used for special case colors, for instance in coloring a special column on your own Queries, or for other Rack headers like the Site Abbr headers.  The appropriate Site() context will be available when needed.

 

Quick-add Resv Type

 

If you've selected "Reservation" for the Default Scheme, this button is available to easily add a complete color scheme setup for a new reservation type.  Just click that button and then select the Reservation Type you want to create a scheme for.  It will automatically add all of the Color Rules needed to override the normal reservation colors with new colors for that reservation type.  The number of rules will depend on the Base Type of the reservation type selected -- for instance, Normal-based types have a lot more conditions than Guest-based types.  All you need to do is edit each rule and change the colors to your liking.

 

You can use this any number of times in the same Color Scheme, to add rules for all of your new reservation types.  Just be sure to avoid adding multiple rule sets for a single reservation type -- it won't necessarily hurt anything, but only the first set would apply, and the extras would just slow things down.

 

Quick-add dates

 

This option will be available if you select "Open Sites" or "None" for the Default Scheme.  This is useful for creating a scheme for Holiday dates, for instance.  Just enter all of the applicable dates or date ranges that you want the scheme to apply to.  A color rule will be added with the appropriate condition expression for those dates.  Note that it will be using ThisDate() for the context, which should work for most uses of this (e.g. as color schemes for open sites on the Rack or for the Date headings).  If the Default Scheme is "Open Sites", it will also include the condition that the site is open and available (normally white, for instance).  If you need a special case, like overriding the color even if the site is marked unavailable, for instance, then it would be up to you to modify the condition.

 

 

Editing Color Rules

 

The Edit Color Scheme Rule dialog is invoked from Edit Color Scheme, when adding or editing rules.  

 

Here you enter a Name for the rule, select the foreground and background colors to be used, and enter an Conditional Expression which defines when the rule is to be used.  You can type the expression directly in the dialog here, or use Insert Expression Element to select and insert elements as needed.  You can also use Test/Edit Expression to open the Expression Creator dialog.  The Expression Creator has basically the same functions as the Color Rule dialog, but it also has the Calculate function for testing the expression.

 

Note that the Name should be as descriptive as possible, explaining what that color rule specifies.  If this Color Scheme is used as a Global Default Scheme for reservations or maps, then the name of each rule will be shown in the Color Key list.

 

You'll notice that each rule has both a foreground and a background color.  You can't just define a rule for the foreground, e.g. to make any unpaid reservation have red text.  You must define rules for every possible combination of colors (at least any that won't be covered by the scheme's "Default scheme").

 

 

How Color Schemes Work

 

When a color scheme is used for a data element, the program executes the Condition Expression for each Color Rule in sequence.  If the expression results in a True (.T.) value, then the color combination selected for that rule is used.  No further rules are processed for that data element.  If the expression results in a False (.F.) value, then it continues checking the following color rules until a True value is found.

 

If none of the rules result in a True value, then it checks for a Default scheme.  If a Default scheme is defined for the Color Scheme, then that will be used to determine the data color.  If not, then the program will probably use whatever default is normally used for the data (e.g. as if no color scheme was specified).  If you want to specify your own default color so that it never uses the program's default, then add a rule to the end with just ".T." (without the quotes) as the Condition Expression.  That will force the last color to be used (since the condition is always True), if none of the previous colors apply.

 

 

Functions for Color Scheme Expressions

 

The context is important in most color schemes, since that's usually the basis for the color rules.  For instance, if the scheme is to be used for coloring Reservations, then the ThisResv() context function will be heavily used in the scheme's rules.  The context functions ThisCust(), ThisSite() and ThisPark() would also be available.  If it's a scheme to be used in a Transactions query, then ThisTran() is also available.

 

The date can also be important for color schemes, e.g. to show on the Rack whether it's paid up to the given date (and scheduled Period if applicable).  The context functions ThisDate() and ThisPeriod() are used to get the specific Rack column date other date of interest, for instance the "as-of" date on Payments Due.

 

In some cases, such as the data color schemes for Cross-table Queries, other context functions are available to get the appropriate information such as ThisValue() or ThisGroupText(). See that section for more details.

 

There are also some special functions that can be useful in color schemes.  Remember that each rule needs to check for a precise condition for the color combination of interest, and yet those conditions should be unique enough not to use the color for the wrong things.  For instance if you want to define a special color for Hourly reservations, you need to do much more than just check the Reservation Type field.  You would probably want several color rules like there are for other types, to indicate different status for hourlies like pending, confirmed, guaranteed, checked in, etc.  You should also make sure these colors don't accidentally apply to special cases like conflicting, canceled, checked out, etc.  

 

So you can see that the expression for a rule might need to check quite a few things, which not only takes your time to create the expressions for but also slows down the processing of the rules.  Therefore some shortcut functions have been added to get a value for the "default" color status that would otherwise be used for Reservations (ColorStatusResv), Map sites (ColorStatusMapSite) or Rack sites (ColorStatusSite).  These return a numeric value based on one of the color-status values in the default color keys, which you can use in a Color Rule expression to determine what color would normally be used.  

 

To get the values returned for each function , go into the Insert Expression Elements dialog, select "Fixed List Values", and select either "Site Status (color default)" or "Map Status (color default)".  When a status is selected in the last column, its numeric value will be shown in the box below.

 

So now you can create a rule that overrides a normal color with an expression that compares the normal status and your specific condition, rather that an expression that has to check several different things.  For example to override the "Resv., Pending, Don't Move, Paid" color for normal reservations to be a different color for hourlies would normally require checking at least 5 different fields for the precise condition, but you can do it with this expression:

 

 ColorStatusResv( Resv(), ThisDate(), ThisPeriod() ) = 37

 AND ResvBaseType( Resv() ) = "Hourly"

 

Note that the expression above is shown on two lines for clarity -- the expression itself should not be broken into two lines, but of course it may wrap automatically in the dialog's edit box.

 

For site-based color schemes for instance on the Rack (particularly if used for a Default Global Color Scheme), use ColorStatusSite.  This will return one of the "Site Status" colors for the reservation(s) on the site if applicable, or the open site, for the given date and period.  For a color scheme that's to be used only on a Reservation-based Query, you can use ColorStatusResv to get the status of a reservation as of a particular date (which may affect paid/not-paid, etc.).  

 

If you create a color scheme to be use as the default on the Map view, use ColorStatusMapSite so that it handles the special map coloring for the site (and also provide the date arguments for the map range, which will be available in the context functions ThisFromDate and ThisToDate).  If you're trying to color the open sites according to an attribute, for instance, be sure to have the expression check that the site would normally be shown "open" for the map as well as for the attribute.  For instance to have a color rule that highlights 50 Amp sites in a different color, use the expression:

 

 ColorStatusMapSite( Site(), FromDate(), ToDate()) = 1 AND Campsites:Attrib_50A

 

Note that a Color Scheme to be use for the Map's Default Global Color Scheme does not need to have a "Default scheme" -- it's assumed to use the Map's normal colors by default.

 

 

 

Additional Topics:

 

Default Global Color Schemes

 

Expressions

 

Queries

 

Forms

 

Advanced Customizations Overview & other topics

 

 

 


Page URL https://CampgroundMaster.com/help/colorschemes.html

Campground Master Home