Comment on page
For consistency, the following naming conventions are used in Trayse Inventory.
Table names are capitalized without spaces. Examples:
A table template has the default fields (see below) and is used to create new tables. Copy the template and rename.
Table names are in all caps. Table template at the top.
With a few exceptions, every table has 8 default fields:
- 1.constant_1 (auto-calc defined as 1)
- 2.ID (primary key, uses Get ( UUIDNumber ) )
- 5.zzCreated (creation timestamp)
- 6.zzCreatedBy (creator)
- 7.zzModified (modification timestamp)
- 8.zzModifiedBy (modifier)
Fields are lower camel case. Examples:
Constants have an underscore between the word "constant" and its value. The values matches the field value. Examples:
Constants are auto-enter calculation fields. As such, the field has no value for existing records and must be manually populated (e.g. server side script).
Globals are appended with an underscore and lower case "g". Examples:
Unstored calculations and summary fields are used sparingly with a preference toward indexed fields updated by a script.
Stored calculations can be helpful for concatinating fields in the same table.
Boolean fields start with the word "is". Examples:
Boolean fields are auto-enter calulations with the following formula:
GetAsBolean ( Self )
Booleans are displayed as a checkbox, using the value of 1. A separate value list exists with 0 and 1, but this is not the list to use with boolean fields. The GetAsBoolean () function will correctly toggle the value between 0 (not checked) and 1 (checked) when using a checkbox. The boolean field also has a validation with the 1 value list.
Not all fields are indexed. Quick Find is not used on any layout, but can be used as part of customization. Fields used on a layout where Quick Find is active should be marked as either included or excluded from Quick Find to properly manage field indexing.
Many fields have comments, particularly if the field name does not easily convey the data the field should have. If a limited set of values are expected (e.g. boolean fields or a small value list), those values are listed. Auto-enter fields show the default value.
Field comments, including default values, where applicable.
Script titles are lower case. Any expected parameters to be passed are shown in parenthesis. Example:
- refresh portal (portalObject, commit)
Optional parameters are shown in brackets. Example:
- export-import path (fileName, [fileType, location])
Comments and spaces are used throughout the scripts. Lengthy scripts use various comment styles to clarify sections of the script.
Every script ends with the script step Exit Script.
A timestamp signature and description are at the bottom of the script. This allows for a log to be built at the bottom of the script without interrupting the readability of the script.
The timestamp signature takes the following formula:
Text expander apps for Windows and Mac simplify the process of adding a timestamp signature.
Script log at the end of the script.
Script information (or meta data) is at the end of the script, not the beginning.
Not every script requires a description, particularly short scripts that are well named.
Short script with time signature. No description required.
Script folders that handle business logic are in capitals. Script folders that are utilitarian are in proper case. Scripts within the folders are in alphabetical order, with occassional exceptions.
A "Read Me" script is often part of the folder.
Scripts within a folder. Scripts are in alphabetical order.
Some scripts are "calling scripts" where the main purpose is to call various subscripts. Those subscripts may be listed below the calling script and prepended with a few spaces.
The open script is a calling script. Subsequent scripts are prepended with a few spaces.
User interface layouts are Proper case and match the table name when possible. User interface layouts for lists are appended with "_l" (lowercase L). Developer tables (i.e. tables for scripts and development purposes) are in capitals and match the table name. They are appended with a "_d". These layouts are empty. An analysis table may exist, if a developer needs to see data on a developer layout.
Layout folders are in Proper case.
User interface layouts at the top. Developer layouts with some analysis layouts at the bottom.