Search Results for code

 

Style Guide, Procedures and Code Documentation

In order for source code to be more readily readable across teams, it is recommended that your source code always be styled according to this style guide.

 

Plus8Decode

Takes three parameters, FieldBase, Fields, IfLenFld

 

UrlDecode$

Takes one parameter, Source

 

Plus8Encode

Takes three parameters, FieldBase, Fields, IfLenFld

 

Plus8Encode$

Takes one parameter, Source

 

Plus8Decode$

Takes one parameter, Source

 

UrlEncode$

Takes one parameter, Source

 

JsonEncode$

Has two parameters: Source, Options

 

 

 

 

 

 

MOX Coding and Programing Language Syntax Documentation

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

 

Command Line with .mox file

A .mox file, with MOX code in it, can be run from the command line while a Moxie.Build system is not otherwise already running.

 

Home

Web/API Development Platform with an in-memory database, native-code CMS, and a powerful runtime environment Whether you are a new startup taking off or optimizing your business model for growth, Moxie.Build provides a robust platform with a proven track record for marketplaces, eCommerce, and business process automation

 

Get Started with Setting up the Development Environment

Developing in Moxie.Build on localhost give you the advantage of working with the template files natively. When working on procedures (MOX code) you need to access that through the Procedures page in the Admin area of a Moxie.Build system, if running the server on localhost or on a remote server. When running on a remote server, you can edit the template files via the Files page in the Admin area.

 

Prefix

Takes a single string as parameter, which is then appended to each line in the code block.

 

Rem / EndRem

A type of Prefix which allows the developer to separate blocks of code into organized, defined parts to help provide clarity of the logical block and add structure to the code.

 

Include

An Include Procedure cannot be executed directly, the contents of its source code can only be Included into other Procedures using the Include command.

 

Query Based Routing Example

For small and simple procedures that are not expected to grow in complexity over time, simple routing based on URL parameter values from a [Pull] directly from the Request query is sufficient and requires less code. For complex procedures that are expected to grow and evolve over time, a larger more robust foundation for the routing should be used.

 

TemplateType

Takes one parameter, Type

 

HtmlSearchBox

Takes 6 parameters, Location, Mode, ActionPath, Name, Class, Prompt

 

HtmlUpload

Takes seven parameters, Location, Mode, Prompt, Path, Class, Name, HelpText

 

HtmlJButton

Takes 6 parameters, Location, Mode, ActionLabel, ActionScript, Class, Extra.

 

HtmlButton

Takes 6 parameters, Location, Mode, ActionLabel, ActionPath, Class, ActionMethod

 

HtmlErr

Takes one parameter, ErrMsg

 

HttpCookie

Takes 6 parameters, Name, Value, Path, Domain, Expires, Other

 

HttpType

Takes one parameter, Type

 

SubTemplate

Takes three parameters, Location, Mode, TemplateName

 

HttpsEnsure

Takes no parameters.

 

HttpHeader

Takes two parameters, name, value

 

HttpNoCache

Has no parameters.

 

Get

Takes two parameters, TableName, IfLenFld

 

ListProcs

Takes one parameter, TableName

 

FlushAll

Has no parameters

 

EmptyTable

Takes one parameter, the name of a database table

 

Flush

Takes one parameter, TableName

 

NewTableField

Takes six parameters, TableName, FieldName, Label, Note, Attr, DevNote

 

NewTableProc

Takes nine parameters, TableName, ProcName, Type, Params, GroupTypes, Label, Note, DevNote, Source

 

New

Takes two parameters, TableName, IfLenFld

 

Login

Takes three parameters, Login, Password, bRememberMe

 

Lookup

Takes six parameters, FieldBase, Destination, Table, Alias, SourceField, IfLenFld

 

Delete

Takes two parameters, TableName and a boolean expression

 

DeleteTable

Takes one parameter, TableName

 

CopyTable

Takes four parameters, DestinationTable, SourceTable, bWithParents, bWithPWHashes

 

AppendTable

Takes one parameter, TableName

 

Attach

Takes 3 parameters, ParentTableName, ChildTableName, IfLenFld

 

Detach

Takes 3 parameters, ParentTableName, ChildTableName, and a boolean expression (optional)

 

DetachWithDelete

Takes 4 parameters, TableName, Relation, OtherTableName, and a boolean expression (optional)

 

DeleteTableRltn

Takes two parameters, a TableName1 and TableName2

 

DeleteTableField

Takes two parameters, a TableName and FieldName

 

DeleteTableProc

Takes two parameters, a TableName and ProcName

 

HtmlBlock / End HtmlBlock

Takes two parameters, Location, Mode

 

Len%

Takes one parameter, a Source value

 

Len$

Takes one parameter, a Source value

 

LastAny$

Takes two parameters, Source, Search

 

Left$

Takes two parameters, Source, Value

 

LoadFile$

Takes one parameter, PathToFile

 

Parse$

Takes four parameters, Source, bAny, Search, Item

 

RawStream$

Takes one parameter, a top query destination variable

 

Login$

Takes three parameters, Login, Password, bRememberMe

 

NbSp$

Takes no parameters

 

InStrAny%

Takes two parameters, Source, Match

 

InStrAny$

Takes two parameters, Source, Match

 

InStr%

Takes two parameters, Source, Match

 

InStr$

Takes two parameters, Source, Match

 

IsValidAlias$

Takes one parameter, a Source value

 

Lang$

Takes one parameter, Source

 

Last$

Takes two parameters, Source , Search

 

JsonStream$

Has one parameter, Options

 

Keywords$

Has one parameter.

 

TabStream$

Takes one parameter, bNoHeaders

 

TextToHtml$

Takes one parameter, Source

 

SSColAlpha$

Takes one parameter, Source

 

SSColNum$

Takes one parameter, Source

 

Truncate$

Takes two parameters, Source, MinLength

 

HtmlAButton

Takes 6 parameters, Location, Mode, ActionLabel, ActionPath, Class, Extra.

 

HtmlAlert

Takes three parameters, Location, ClassNames, AlertText

 

WebSafe$

Takes one parameter, Source

 

Html

Takes 3 parameters, Location, Mode, Text

 

RecoverMOX$

Takes one parameter, HtmlEscapedString, and returns the Unescaped Version of this string

 

RecoverTmpl$

Takes one parameter, EscapedTemplate, and returns the Unescaped Version of this string

 

RecoverHtml$

Takes one parameter, EscapedHTMLString, and returns the Unescaped Version of this string

 

RecoverHtmlObj$

Takes one parameter, EscapedHTMLString, and returns the Unescaped Version of this string

 

Replace$

Takes one existing Source value, and two parameters, Search, NewVal

 

Setup$

Takes one parameter, Name

 

Sgn%

Takes one parameter, Value

 

Right$

Takes two parameters, Source, Value

 

SessionIsGroupType$

Takes one parameter, a List of possible group types

 

SetEnsure

Takes two parameters, FieldName, Value

 

SetFirst

Takes four parameters, FieldBase, Destination, Source, IfLenFld

 

SendEmail

Takes 10 parameters, FieldBase, From, To, Subject, Body, bMerge, AttachName, AttachPath, Slow, IfLenFld

 

Set

Takes four parameters, FieldBase, Destination, Source, IfLenFld

 

SetIf

Takes six parameters, FieldBase, Destination, Source, Left, Comparison, Right

 

SetLast

Takes four parameters, FieldBase, Destination, Source, IfLenFld

 

SetNew

Takes four parameters, FieldBase, FieldName, Source, IfLenFld

 

SetIfAll

Takes a variable number of parameters, FieldBase, Destination, Source, Test1, Test2, [etc...]

 

SetIfAny

Takes a variable number of parameters, FieldBase, Destination, Source, Test1, Test2, [etc...]

 

SaveTabFile

Takes two parameters, FileName, bUseHeader

 

Offset

Takes 7 parameters, FieldBase, Destination, Source, OffsetVal, Operator, OpValue, IfLenFld

 

Parse

Takes seven parameters, FieldBase, Destination, Source, bAny, Delimiter, Item, IfLenFld

 

MergeRecords

Takes 5 parameters, FieldBase, GroupBy, MergeField, Delimiter, bKeepBlanks

 

Num

Takes 6 parameters, FieldBase, Destination, Function, Source, Value, IfLenFld

 

ParseRecords

Takes two parameters, WorkFieldBase + FieldToParse, Delimiter

 

ResetFields

Takes two parameters, FieldBase, FieldNames

 

SaveCsvFile

Takes two parameters, FilePath, bUseHeader

 

PickFirstField

Takes three parameters, FieldBase, Destination, SourceFields

 

Pull

Takes three parameters, QueryName, FieldBase, FieldNames

 

HtmlForm

Takes 6 parameters, Location, Mode, ActionLabel, ActionPath, Class, ActionMethod

 

HtmlNav

Takes 7 parameters, Location, Mode, Title, TitleLink, Class, HtmlPre, HtmlApn

 

HtmlDTable

Takes 5 parameters, Location, Mode, Class/ID, Init, bNoAutoAlign

 

HtmlETable

Takes 6 parameters, Location, Mode, Div, Data, Script, Extra

 

HtmlNavbar

Takes 10 parameters, Location, Mode, Title, TitleLink, Class, Fixed, bNotResponsive, bInverted, HtmlPre, HtmlApn

 

HtmlTable

Takes 6 parameters, Location, Mode, Class, bNoHeader, bNoAutoAlign, bNoIDTags

 

Lang

Takes four parameters, FieldBase, Destination, Source, IfLenFld

 

HtmlRaw

Takes 3 parameters, Location, Mode, bWithNoHeader

 

HtmlTab

Takes 3 parameters, Location, Mode, bWithNoHeader

 

HtmlDropdown

Takes 5 parameters, Location, Mode, Title, Element, Class

 

Text

Takes six parameters, FieldBase, Destination, Function, Source, Value, IfLenFld

 

Time

Takes six parameters, FieldBase, Destination, Function, Source, Value, IfLenFld

 

Sort

Takes two parameters, FieldBase, SortFieldList

 

SSReference

A command to help build spreadsheets

 

Value

Takes four parameters, FieldBase, Destination, Function, IfLenFld

 

GetFieldDefs

Has no parameters.

 

HtmlBlocks / End HtmlBlocks

Takes two parameters, Location, Mode

 

WithAll

Takes five parameters, FieldBase, Destination, Action, Source, IfLenFld

 

WithGroup

Takes six parameters, FieldBase, GroupByField, Destination, Action, Source, IfLenFld

 

MergeFields

Takes 4 parameters, FieldBase, Destination, SourceFields, Delimiter

 

UpdateTableProc

Takes ten parameters, TableName, OldProcName, NewProcName, Type, Params, GroupTypes, Label, Note, DevNote, Source

 

UpdateTableRltn

Takes eight parameters, TableName, OldOtherTableName, NewOtherTableName, ParentChild, Ratio, Note, Attr, DevNote

 

UpdateOrNewWithAttach

Takes four parameters, TableName, Relation, OtherTableName, IfLenFld

 

UpdateTableField

Takes seven parameters, TableName, OldFieldName, NewFieldName, Label, Note, Attr, DevNote

 

Build

Takes a variable number of parameters

 

EnsureNavFields

Takes two parameters, FieldBase, FieldNamesList

 

ETableStream

Takes two parameters, ExcelTableData, Options

 

DeleteFields

Takes two parameters, FieldBase, FieldNameList

 

EnsureFields

Takes two parameters, FieldBase, FieldNames

 

UpdateOrNew

Takes two parameters, TableName, IfLenFld

 

Parents

Takes three parameters, ChildTableName, ParentTableName, Mode

 

ParentsAlias

Takes three parameters, ChildTableName, ParentTableName, Mode

 

NewTableRltn

Takes seven parameters, TableName, OtherTableName, ParentChild, Ratio, Note, Attr, DevNote

 

NewWithAttach

Takes 4 parameters, TableName, Relation, OtherTableName, IfLenFld

 

Search

Takes three parameters, TableName, SearchTerms, SearchInFields

 

SkipCalls

Takes no parameters

 

Update

Takes two parameters, TableName, IfLenFld

 

Session

Takes two parameters, Name, Value

 

Setup

Takes two parameters, Name, Value

 

ListFiles

Takes 3 parameters, Folder, Filter, bShowImgSize

 

ListFolders

Takes two parameters, FolderPath, bRecursive

 

KeepIfSimilar

Takes 3 parameters, FieldBase, pOne, pTwo

 

KeepUnique

Takes one parameter, FieldName

 

LoadCsvFile

Takes two parameters, FileName, bHasHeader

 

LoadTabFile

Takes two parameters, FileName, bHasHeader

 

Math

Takes a variable number of parameters

 

LoadNulFile

Takes two parameters, FileName, bHasHeader

 

LoadRawFile

Takes one parameter, FilePath

 

KeepIfFound

Takes 3 parameters, FieldBase, Fields, SearchTerms

 

Format

Takes five parameters, FieldBase, FieldList, Mask, bBlanks2Zero, IfLenFld

 

Geo

Takes nine parameters, FieldBase, Destination, Function, Source1, Source2, Source3, Source4, Options, IfLenFld

 

Files

Takes 5 parameters, FieldBase, Destination, Action, Source, IfLenFld

 

FixFields

Takes one parameter, a single character

 

Group

Takes 7 parameters, FieldBase, GroupBy, GroupTotals, GrandTotals, Seperator, TotalPre, TotalPost

 

KeepIf

Takes 4 parameters, FieldBase, Left, Comparison, Right

 

KeepIfAll

Takes a variable number of parameters, FieldBase, Test1, Test2, [etc..]

 

Images

Takes up to 6 parameters, FieldBase, FileName, Action, Val1, Val2, IfLenField

 

JsonEmbed

Has six parameters, UniqueParent, DestField, FieldBase, UniqueChild, EmbedFields, Options

 

HttpSoap$

Takes 8 parameters, ServerName, Port, bSecure, Path, ExtraHttpHeaders, Envelope, ExtraBody, xml

 

Export and Import of Database Schema

ExportSchema and ImportSchema are BuiltIn procedures that are available for use with source control systems.

 

Folder and File Structure

Brief overview on the file structure and contents under Moxie. The files and folders discussed in this post are those that are essential when upgrading to the most recent version of Moxie , or when troubleshooting server errors.

 

[Sort] (DB Relationship Attribute)

Accepts a space separated list of field names.

 

 

AjaxReply

Has no parameters

 

CopyFields

Takes two parameters, DestinationFields, SourceFields

 

Message Handler

A Message Handler is only ever called by the Database on a Database Event. These Event Messages allow a Developer to intercept operations taking place on a per-record level and implement Event based business logic.

 

Public Method

A Public Method may be called from any other Procedure, by the Default plug-in, or a Custom COM DLL. Each Public Method may either use specific Input Parameters, or it may accept an Input Query.

 

[+] Sum of Field of Attached Child Records

Parameter is the table and field name that you want to sum in the form of TableName.FieldName. The specified Table must be a Child of the calling Record.

 

[Temp] Field

Parameter is a single new field name or a space separated list of new field names.

 

[SearchSort]

Parameter is a space separated list of field names to have the display table sorted by when displaying search results in the Admin interface.

 

[State] Error State

Takes one parameter.

 

[FieldList]

Parameter is a space separated list of field names to be displayed.

 

 

[Time] (DB Field Attribute)

Has no parameters.

 

 

CopyQuery

Takes two parameters, destinationQuery, sourceQuery

 

If (Not) / Then

Takes a single Field name, with an optional Not operator, followed by the conditional statement

 

Image

Has 5 parameters, DestFileName, Action, SrcFileName, Val1, Val2

 

GoTo

Takes one parameter, a Label

 

If (Not) / And / Or / ElseIf / End If

Takes a variable number of conditional statements

 

JoinQuery

Takes 5 parameters, DestinationQuery, SourceQuery, DestinationMatchField, SourceMatchField, Mode

 

JsonReply

Has no parameters

 

Include

Takes one parameter, ProcedureName

 

IncrKillCount

Has one parameter.

 

[Ensure] Field Exists

Takes a variable number of parameters, a comma separated list of TopQuery variable names

 

FailIfRecError

Has no parameters

 

CopyUnique

Takes four parameters, DestinationQuery, SourceQuery, UniqueField, UniqueValue

 

EmailErr

Takes two parameters, SubjectPrefix, EmailBody

 

ForEach

Takes a variable number of parameters, QueryName, MethodName, [Param1, [Param2, etc...]]

 

Foreign

Takes a single parameter, a QueryName

 

File

Takes 3 parameters, Destination, Action, Source

 

Folder

Takes two parameters, FolderPath, Action

 

[Ajax]

Takes 3 parameters, Trigger, DestinationID, Path

 

[&] Count Attached Child Records

Takes 1 Parameter which is the Table name that you want to count the Attached Records in. The specified Table must be a Child of the calling Record's Table.

 

[A] Copy Attached Value

Parameter must first specify only looking at Parents ( PARENT ) or only looking at Children ( CHILD ). The remainder of the parameter should be the table and field name you are after in the form of TableName.FieldName.

 

[AccKey] Keyboard Accelorator Key

Takes one parameter which is the keyboard key which will be used as the Access Key for a given Database Table's field.

*Note: By default, each Field's Access Key will be initialized to the first character of the Field's Label.

 

[Date] (DB Field Attribute)

Has no parameters.

 

 

 

[D] Default Value

Parameter is a value or an expression to be used when a record is created if no value is specified during the creation. The value or expression is run through the Assignment Attribute in order to calculate it's result.

 

Learn More About Managing Files

Prerequisites: This tutorial assumes that you have already set up your Moxie.Build server and logged in. This page covers some of the basics that are involved in managing files and folders in the Moxie.Build system.

 

 

 

Learn More about Frontend Development

Prerequisites: This tutorial assumes that you have already set up a Category and Procedure if necessary. This page covers some of the basics that are involved in Front End development using the MOX language.

 

Templates Documentation

Prerequisites: This tutorial assumes that you have already learned about Managing Files .

 

 

 

Licensing

Moxie.Build, in short, may be used and licensed free of charge for education and non-profit organizations. Whenever it is used by government or for-profit organizations the license is granted on a subscription basis.

Moxie.Build includes a number of open source components as part of its distribution; each is subject to their own licenses as included with the files for those components.

 

[DatePicker]

Takes no parameters

 

[Min]

Accepts a numeric value as a parameter.

 

[MText] Multiline Text Editor

Accepts one optional numeric value as a parameter

 

[MaxLen]

Accepts a numeric value as a parameter.

 

 

[Score] 0.0 to 10

Accepts 3 parameters, first is required, 2nd and 3rd are optional. A trailing optional expression after an = sign may also assign a value on the same line.

 

[SearchFieldList]

Parameter is a space separated list of field names to be displayed when the user is viewing results from the Search List in the Admin interface.

 

[Raw] Raw HTML

Accepts one parameter which is the raw HTML content to be placed in the form at the Field's location.

 

[R] Readonly

Has no parameters.

 

[Footer] Raw HTML

Accepts one parameter which is the raw HTML content to be placed in the form, below the Field's location.

 

[Header] Raw HTML

Accepts one parameter which is the raw HTML content to be placed in the form, above the Field's location.

 

 

 

[Markdown]

Has no parameters.

 

[Max]

Accepts a numeric value as a parameter.

 

[If] Assignment (DB Field Attribute)

Parameter is divided into two parts, the Test and the Result if True. The test comes prior to the keyword of Then and the Result if True comes after.

 

[!] Limited Selection List

Parameter is a comma separated list (using CSV rules and not in quotes) of the options made available to the user which are enforced on save. To use different values than labels, for each comma separated pair, specify the value first inside of { } followed by the label.

If the Parameter is just the single word Checkbox, then instead of a drop down list with values, the user will be given a single checkbox: If the field is unchecked the value will be blank, and if it is checked the value will be "y".

When this attribute is used with a Top Query in MOX, it will ensure the field value matches one of the options; if not, it will throw a run time error.

 

LangWith

Has one parameter, a Content.Lang prefix

 

Dir$

Takes one parameter, a path-mask

 

DnsIp$

Takes one parameter, a domain name

 

DayOfWeek$

Takes one parameter, a date

 

Decrypt$

Takes two parameters, an encrypted value and the decryption key

 

Exists$

Takes two parameters, DBTableName, DBTableRecordAlias

 

Exp10%

Has one parameter, any numeric value.

 

DnsName$

Takes one parameter, an IPv4 Address

 

Encrypt$

Takes two parameters, SourceValue, EncryptionKey

 

Cos%

Takes one parameter

 

Cuid$

Has no params

 

Chr$

Takes one parameter

 

Compress$

Compress any value/table

 

DateTime$

Takes one parameter, a string containing a date and time

 

Day$

Takes one parameter, a date

 

Date$

Takes one parameter, a string containing a date

 

DateAmPm$

Takes one parameter, a string containing a date and time

 

Greg$

Takes one parameter, a gregorian number

 

Guid$

Takes no parameters

 

GeoDistance$

Takes five parameters, Lat1, Long1, Lat2, Long2, Options

 

Greg%

Takes one parameter, a date of the form yyyy-mm-dd

 

HtmlToText$

Takes a single parameter, Source

 

Http$

Takes 9 parameters, ServerName, Port, bSecure, Mode, Path, ContentType, extraHeader, body, rtnHeaders

 

Hash$

Takes one parameter, a source value

 

Hex$

Takes one parameter, a source value

 

ExtractAny$

Takes two parameters, Source , Search

 

FieldDef$

Takes one parameter, FieldName

 

Exp2%

Takes one parameter, any numeric value.

 

Extract$

Takes two parameters, Source, Search

 

FirstAlias$

Takes one parameter, TableName

 

FolderExists$

Takes one parameter, the path of the folder

 

FileExists$

Takes one parameter, the path where the file is located.

 

FileSize$

Takes one parameter, a value in number of bytes.

 

CheckPw$

Takes two parameters, User and Password

 

[Pull] List of Fields from another Query

Takes three parameters, QueryName, FieldBase, FieldNames

 

Remote

Takes three parameters, Url, InputQuery, OutputQuery

 

OnError (Continue)

Used as a scoping keyword, similar to WorkWith/End WorkWith .

 

PaaS

Takes three parameters, Url, SaaSTenant, InputQuery, OutputQuery

 

ServerLog

Takes one parameter, ServerLogText

 

SetKillCount

Takes one parameter, Value

 

SaveHttpFile

Takes two parameters, FileName, URL

 

Select / Case / End Select

Takes a variable number of conditional statements to compare against a single source

 

MapQuery

Takes five parameters, DestQuery, SourceQuery, SourceXFld, SourceYFld, SourceZFld

 

Method

Private Method contained within a given procedure.

 

LookupQuery

Takes six parameters, DestQuery, SourceQuery, DestDestFld, DestXFld, DestYFld, SourceYFld

 

Macro

A set of instructions that can be called with parameters to run in the current scope.

 

NewEComQuery

Takes one parameter, QueryName

 

NewQuery

Takes 3 parameters, QueryName, SourceQuery, bWork

 

MsgBox

Takes two parameters, Text, Title

 

[New] Field

Takes one parameter, a comma separated list of FieldNames

 

[ ? ] Pick First (Top Query)

Parameter is a space separated list of fields to choose from

 

Abs%

Has one parameter, a numeric value.

 

[CountIf]

Takes one parameter, TestCondition

 

[If] Assignment (Top Query)

Parameter is divided into two parts, the Test and the Result if True. The test comes prior to the keyword of Then and the Result if True comes after.

 

AmPm$

Takes one parameter

 

ApplyLang$

Takes one parameter

 

ATn%

Takes one parameter

 

AnsiToUtf16$

Has one parameter.

 

AnsiToUtf8$

Has one parameter.

 

TRON

Takes one parameter, FilePath

 

TRONLog

Takes one parameter, OutputText

 

Sleep

Takes one parameter.

 

Thread

Takes a variable number of parameters

 

Moxie.cfg Config

The Moxie.cfg file is read on server start and controls aspects that cannot be changed while the server is running

 

Nightly Management Utility

This utility program manages a server install with one or many Moxie.Build services running by taking care of nightly tasks via a scheduled task

 

Cloudflare Integration

Cloudflare is a first and foremost a Web Application Firewall and Content Distribution Network, among other additional services

 

Lookup$

Takes one parameter, in the form of: Table|{Alias}|Field