Syntax and Builtin Values, Procedures and Code Documentation

The MOX language pays heritage to BASIC, but has been crafted for the specific type of work and environment that is demanded of Moxie.Build.

Notable Aspects of the MOX Language

The following items may catch developers experienced in other languages off guard; trust us, they are good for you :)

Lines of Code

In the following rules, a line of code is one executable item as viewed by the compiler. A line of text refers to one line in a text editor.

Comments

Parameters

Procedures

All executable code in Moxie.Build is stored in Procedures, each with a unique name, in the Database Tables. There are many different types of Procedures, each with a specific purpose, and are described in detail on the Types of Procedures page.

Memory Scope

Memory Scopes in Moxie.Build are called Queries. Each Query may contain zero or more Fields, and one or more Records; similar to a table structure. There is always at least one Record, even if that Record only contains blank Fields.

Procedures

All Procedures (other than Includes) start with two queries, named Input and Output. What these Queries contain at the start of a Procedure is described in further detail on the page for each Procedure Type.

Private Methods & Functions

Within a Procedure, each Private Method/Function is also given two Queries, named Me.Input and Me.Output.

Me.Input

Me.Output

Top Query & Work Query

Text Operators

Math Operators

All math inputs are cleaned up using the following rules:

Operator Precedence

Global Glyphicons & PNG Icons

In any output to the end user, regardless of source, and including text literals within MOX code, you can make use of the Template system's Glyphicons shorthand. The available Glyphicons are those of Bootstrap V3. Note the Bootstrap documentation calls for a space between a Glyphicon and any text.

Instead of using the full bootstrap HTML with class of:

<span class='glyphicon glyphicon-search' aria-hidden='true'></span>

Just use the following instead:

<? i search ?>

Also, PNG icons can be referenced using the following syntax:

<? ii Folder/FileName ?>

Which will be expanded into the following HTML:

<img class='FileIcon' src='/Icon/Folder/FileName.png' />

The value provided for FileName may not be larger than 64 bytes, and valid characters in the file name are limited to the following:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/-_.

The class of FileIcon is not defined anywhere by default, it is just there in case you need it. Moxie.Build does not come with any icons in the /Public/Icon folder; it is up to you to provide you own. Note that most PNG icon libraries that can be sourced will include different sized icons in different folders, therefore, selecting the icon of the size you want is part of the provided FileName.

Builtin Values

The following Text and Numeric Values are built into the language and may be used anywhere a Top Query Field may otherwise be used. When used by self as a value for a Work Query Parameter, they will need to be solved with ( ).

Request Query

The following values are built into the Request Query, and may be pulled into other queries to be utilized. It is not recommended to work with these values in the Request Query itself.

  • Head.  All HTTP Headers start with this prefix
  • Cookie.  All HTTP Cookies start with this prefix
  • Req.Addr  IP Address of client
  • Req.Body  HTTP Post Body, up to Cfg RAMRecvSize
  • Req.Boundary  HTTP Post Body Boundary
  • Req.Category  If page is a Category, the Alias of
  • Req.ClientRecv  Bytes Received by Server so far
  • Req.ClientSent  Bytes Send by Server so far
  • Req.Completed  Connections Closed by Server so far
  • Req.CurPage  Current Page File usage
  • Req.CurWork  Current Working Set size
  • Req.Current  Current Connections Open on Server
  • Req.Country  Country of IP per Cfg CountryInfo
  • Req.Details  Raw copy of HTTP Headers
  • Req.FileName  Name of file from /Recv
  • Req.FileSize  Size of file in /Recv
  • Req.HasFile  Is true if file data in /Recv
  • Req.Hits  Number of Requests to Server so far
  • Req.Host  Request Host Header value
  • Req.IsCmdMox  Set if running .mox file via cmd
  • Req.IsDelete  Set if Request mode set to Delete
  • Req.IsGet  Set if Request mode set to Get
  • Req.IsPost  Set if Request mode set to Post
  • Req.IsPut  Set if Request mode set to Put
  • Req.Lang  Current client Language
  • Req.Mode  Request mode, such as Get or Post
  • Req.PageFaults  Number of Page Faults so far
  • Req.Path  Request path, no parameter, no leading /
  • Req.PathBase  Full URL, preserving Admin params
  • Req.PathWithParams  Full URL, with leading /
  • Req.PeakPage  Highest Page File usage so far
  • Req.PeakWork  Highest Working Set size so far
  • Req.Peek  Highest Current Connections count so far
  • Req.Port  Server side completion port number
  • Req.Post  If page is a Post, the Alias of
  • Req.Protocol  Request protocol, such as http or https
  • Req.RelayHttpsHost  Cfg RelayHttpsHost
  • Req.ServerAddr  IP Address Server is listening on
  • Req.ServerHttpPort  HTTP Port Server
  • Req.ServerHttpsPort  HTTPS Port Server
  • Req.Unique  Unique cookie value per visitor

Text Values

  • $B  Chr$ 6 (internal flag for DB Backfill fields)
  • $Br  HTML line break
  • $Cr  Chr$ 13 (carriage return)
  • $CrLf  Chr$ 13, 10 (carriage return, line feed)
  • $CUID  Cnawlece spec. unique id
  • $DQ  Chr$ 34 (double quote)
  • $Day  Day of the month, 2 digits
  • $DayOfWeek  Sunday, Monday, etc.
  • $Delimiters  Chr$ 0 to 7 (2 to 5 are user defined)
  • $F  Chr$ 1 (internal DB field delimiter)
  • $Greg  Day as a Gregorian number
  • $Gt  Chr$ 62 (greater than)
  • $GUID  Microsoft spec. unique id
  • $I  Chr$ 2 (item separated in field data or #Attr list)
  • $Lf  Chr$ 10 (line feed)
  • $Lt  Chr$ 60 (less than)
  • $Month  Month of the year, 2 digits
  • $NbSp  HTML non-breaking space
  • $Now  YYYY-MM-DD HH:MM:SS
  • $NowFile  YYYY-MM-DD-HHMMSS
  • $NowX  YYYY-MM-DD HH:MM:SS.ss
  • $NowXFile  YYYY-MM-DD-HHMMSSss
  • $Null  Chr$ 0 (null)
  • $QCQ  Chr$ 34, 44, 24 (dq comma dq)
  • $R  Chr$ 0 (internal DB record delimiter)
  • $RootPath  Full disk path to DBStore folder
  • $SQ  Chr$ 39 (single quote)
  • $SessionGroupTypes  $I separated list
  • $SessionID  Unique session id for logged in user
  • $SessionIsBad  Contains reason session isn't good
  • $SessionName  FirstName && LastName
  • $SessionTable  eg. MemTab.Person
  • $SessionUser  Alias of user in $SessionTable
  • $Spc  Chr$ 32 (space)
  • $Tab  Chr$ 9 (tab)
  • $Time  HH:MM:SS
  • $Timer  CPU Counter, accurate to 0.0001
  • $Today  YYYY-MM-DD
  • $ValidAlias  Characters valid for a DB Record Alias
  • $ValidDBField  Characters valid for a DB Field Name
  • $ValidTable  Characters valid for a DB Table Name
  • $Version  Currently-running version of Moxie.Build
  • $WhiteSpace Chr$ 32, 13, 10, 9 (space, crlf, tab)
  • $Year  YYYY
  • $XmlHead  Shorthand for XML header string, UTF-8

Numeric Values

  • %‍Day  Day of the month, 2 digits
  • %‍DayOfWeek  Day of the week, Sunday = 1
  • %Greg  Day as a Gregorian number
  • %Month  Month of the year, 2 digits
  • %Now  YYYYMMDDHHMMSS
  • %NowX  YYYYMMDDHHMMSSss
  • %Pi  3.14159265358979323
  • %Time  HHMMSS
  • %Timer  CPU Counter, accurate to 0.0001
  • %Today  YYYYMMDD
  • %Year  YYYY