Contents

All Functions

The following is a list of all the functions available in DbfScript:

String SanitizeJS(String str)
Checks the string str to see if it contains any characters that may allow for script injection in Javascript. Throws an error if it does.

NoReturn profiler:Enable(Boolean onOff)
Switches on or off (false) the profiler, recording script profiling information.

List profiler:LogScriptLines()
Returns a list of the top-most script lines that took the longest to run during the profiler session. Useful for performance optimization.

NoReturn security:VerifySignature(Path path)
Verifies the digital signature stored at the given path, checking that the data has not changed since it was signed, and that the signature is valid.

String security:SignRecord(Record node, String excludeFields)
Returns encrypted and signed data for the given record.

List GetTimeSeries(List data, String dateField, String valueField, DateTime startDate, DateTime endDate, String increment, String aggr)
Returns time series list for date-based data in the given list (data), using the given dateField, valueField, between startDate and endDate.

String DisassembleNode(Record node, List files)
Returns XML for the given record, putting all file data into the given list (files).

Record ReassembleNode(String xml, List files, Path path)
Reassembles the given record from XML and a list of files, for inserting into the given path (path). Doesn't insert the data, just returns it.

Boolean IsHosted()
Returns True if the server is running in a hosted environment.

String AccountName()
Returns the name of the account that the hosted server is running under.

NoReturn InsertAt(List seq, Record node, Number index)
Inserts the given record (node) into the list (seq) at the specified index.

NoReturn Notify(Path path, Record data, String notifyName, String desc, Any overrideUsers)
Invokes any subscribed notifications at the given path, with the given changed data (data), for the specified notification name (notifyName), specifying the description (desc) and optionaly overriding the users that the notification wil be sent to (overrideUsers, a list of User records).

Boolean CheckPasswordStrength(String pass)
Validates the given password string, and returns True if the password meets the necessary strength (ISO PS008 compliant).

Any table:Create(Number cols, Number rows, Number colGroups, Number headerRows, Number sideCols, Boolean sideTotal, Boolean bottomTotal)
Creates a table structure, used for managing and rendering tables of values. Specifies the number of rows in the table, column groups (colGroups, normally 1), headerRows (normally 1), side columns (normally 1, for the row title), sideTotal (true if you want an end of row total), bottomTotal (true if you want an end of table total).

NoReturn table:Set(Any table, Number col, Number row, Number colGroup, Any val, Any num)
With the table returned from table:Create, sets the data value (num) and displayed vaue (val), at the specified column (col), row (row), column group (normally 1).

Any table:Get(Any table, Number col, Number row, Number colGroup)
Retrieves the data value for the given table's column (col), row (row) and column group (colGroup, normally 1).

NoReturn table:SetTotalFormat(Any table, String format)
Sets the total cells formatting string, eg. #,##0.00 or c for currency.

NoReturn table:ExcludeRowSideTotal(Any table, Number row)
Indicates that the given row in the table should not show a total.

NoReturn table:OverrideSideTotal(Any table, Number row, String text)
Indicates that the total for the given row should be overridden with the given text.

NoReturn table:SetSide(Any table, Number col, Number row, Any val)
Sets the label (side of the row).

NoReturn table:AddTotalsRow(Any table, Number atRow)
Adds a total row at a specific row.

NoReturn table:SetHeader(Any table, Number col, Number row, Number colGroup, Any val)
Sets the header value for a given column.

String table:RenderToString(Any table)
Renders the table to HTML in a text string.

List table:RenderToSequence(Any table)
Renders the table to HTML as a list of strings, suitable for a Custom Render in a Quick Report.

List table:Render(Any table)
Renders the table to HTML as a list of strings, suitable for a Custom Render in a Quick Report.

List Pop3:GetHeaders(String server, String user, String password, String lastMessageID, Number max)
Retrieves email headers from the given POP3 server (server), for the given user and password. Specifies the last message ID that was retrieved, and the maximum number of emails to return.

List Pop3:GetMessages(String server, String user, String password, String lastMessageID, Number max, Boolean allowHtml)
Retrieves email messages from the given POP3 server (server), for the given user and password. Specifies the last message ID that was retrieved, and the maximum number of emails to return. If allowHtml is set, then the emails may contain HTML encoding.

NoReturn Pop3:DecodeMessages(Path path, List messages)
Decodes the list of messages retrieved in GetMessages such that any references to counter fields in the subject will automatically be associated with the given record. A link to the record will be inserted into the message.

NoReturn PrematureExit()
Commits the current transaction but then aborts the remainder of any processing.

NoReturn SetGlobalVar(String name, Any var)
Sets a global variable which will be accessible from any session or thread for the duration of the server uptime.

Any GetGlobalVar(String name)
Retrieves a global variable set with SetGlobalVar.

NoReturn SetPriority(Number priorPerc)
System-level call. Sets the current thread's priority in percent. If 100% then gives it the top priority among all processes running on the system.

Number GetNewPosition()
Returns a number suitable for storing in a position for a record. Increases based on time.

NoReturn CloseFiles(Record node)
Closes all open file handles in the given record.

NoReturn CloseFile(FileData fd)
Closes an open file handles in the given FileData.

FileData CloneFile(FileData file)
Clones a file so it can be duplicated in a different record.

Path GetRandomRecordPath(Path path)
Retrieves a random record from the given list path.

String image:OCR(FileData file)
Runs an OCR on the given image held in the file. Requires OCR extensions to be installed on the server.

FileData image:OCRPreprocess(FileData file)
Performs OCR preprocessing (contrast adjustment and cropping), and returns a new image suitable for running OCR. Experimental.

Record image:GetInfo(FileData file)
Returns information about an image file, including the dimensions and luminance.

FileData image:ExtractImage(FileData file, Number x1, Number y1, Number x2, Number y2)
Extracts a sub-image from the given image, with the specified coordinates.

FileData image:CropImage(FileData file, Number dwidth, Number dheight, Boolean center)
Crops the given image to the specified dimensions.

FileData image:CropToEdges(FileData file)
Crops the given image to the detected edges. Experimental.

FileData image:OverlayImages(FileData file1, FileData file2)
Combines two images, presuming the second image contains an alpha (transparency) channel.

FileData image:ResizeImage(FileData file, Number dwidth, Number dheight)
Resizes the given image to the specified dimensions.

String InternalGetDBEngine()
Retrieves the name of the database engine used in this application.

List FilterByDateRange(RecordOrList olist, String dateField, DateTime start, DateTime end, Boolean changeDates)
Filters the given list by the given dates, returning a new list of entries in those dates only.

Any Run(String id, Record input)
Runs the given plugin name (id) with input as the parameter for the plugin.

Any RunPlugin(String id, Path path, Record input)
Runs the given plugin name (id) passing in path for &path, with input as the parameter for the plugin.

List GetNextRows(Record node, Number count)
Gets the next rows (count) after the given record.

Number geo:GetLong(Record node)
Retrieves the longitude value from the given record (node) that has mapping enabled.

Number geo:GetLat(Record node)
Retrieves the latitude value from the given record (node) that has mapping enabled.

List geo:GetMapPoints(Path path, Number lon1, Number lat1, Number lon2, Number lat2, Number cellsLong, Number cellsLat, String groupField)
Retrieves map points for map data at the given path, in the given bounding area (lon1/lat1, lon2/lat2), split into cellsLong and cellsLat grid, grouped by the specified field. May use r-tree optimization if the database engine supports this.

Number geo:GetDistance(Any recPath1, Any recPath2)
Returns the distance between two records that contain mapping information. Crows-fly path.

NoReturn UnSet(Record node, String field)
Removes (unsets) the field in the given record (node).

String StackTrace()
Returns a stack trace at the current execution point.

String str:NodeToTextEx(Record node, Boolean includeDefaultValues)
Returns a textual render of the given record, optionally including default values.

String str:ToASCIIOnly(String text)
Returns an ASCII only rendering of the given string, removing any unicode characters.

String str:Join(ICollection list, String delim, String lastDelim)
Joins together all text items in the list (list), putting delim between them, and lastDelim at the end.

Any str:NewStringBuilder()
Returns a string builder, which is used to create large strings efficiently.

NoReturn str:Append(Any strBuilder, String str)
Adds text to a string builder efficiently.

String str:MakeIdentifier(String name)
Returns a value suitable for use as an code identifier.

String str:ToBase64(String name)
Returns the base64 encoding for the given string (name).

String str:Encrypt(String name, String password)
Encrypts the given data using the given password.

String str:Decrypt(String name, String password)
Decrypts the given encrypted data using the given password.

String str:ToHMAC(String name, String key, String algo)
Returns an HMAC hash digest of the given data. Currently algo should be HMACSHA1.

String str:FromBase64(String name)
Decodes data from base64 encoding.

String str:Replace(String origStr, String toFind, String replaceWith)
Replaces the first occurrence of toFind in origStr with replaceWith.

String str:ReplaceAll(String origStr, String toFind, String replaceWith)
Replaces all occurrences of toFind in origStr with replaceWith.

String str:ReplaceIgnoreCase(String origStr, String toFind, String replaceWith)
Replaces the first occurrence of toFind in origStr with replaceWith, regardless of case.

String str:StripOutHtml(String origStr)
Removes all HTML encodings from the given text.

String str:ToString(Any any)
Returns a string representation of any data.

Boolean str:Contains(String text, String token)
Returns true if the token is found in text.

Boolean str:StartsWith(String text, String token)
Returns true if text starts with token.

Boolean str:EndsWith(String text, String token)
Returns true if text ends with token.

String str:Trim(String text, String token)
Trims the given text of any occurrences of token (usually a space character).

String str:ToUpper(String text)
Returns an uppercase version of text.

String str:ToTitleCase(String text)
Uppercases the first initial of each word in text.

String str:ToLower(String text)
Returns a lowercase version of text.

Number str:Syllables(String text)
Estimates the number of syllables in text.

Number str:IndexOf(String text, String token)
Returns the 0-based index of token in text.

String str:RandomPassword()
Returns a new random password.

String str:Split(String text, String token, Number index)
Splits text into a list of tokens and returns the item at index (1-based).

List str:SplitIntoList(String text, String token)
Splits text into a list of tokens, returns that list.

Number GetMemoryUsage()
Returns the current memory usage of the process.

NoReturn Sleep(Number ms)
Makes the thread sleep for ms milliseconds.

NoReturn workflow:SetStage(Record node, String workflowName, String stage)
Sets the stage of the given workflow record for workflow (workflowName) to stage (stage).

NoReturn CopyFields(RecordOrList source, Record target)
Copies all fields from source to target.

NoReturn CopyChangedFields(Record source, Record target)
Copies all changed fields from source to target.

Record Cast(Record node, Path path)
Converts the record (node) to the type at the given path.

Path AddPredicate(Path path, String predicate)
Adds a predicate (predicate) to the end of the path.

List NewList()
Returns a new empty list.

Record NewRecord()
Returns a new empty, untyped record.

Record NewSubRecord(Record record, String field)
Returns a new record typed to be inserted into field within the given record.

List NewSubList(Record record, String field)
Returns a new list typed to be inserted into field within the given record.

Any GetVarByName(String name)
Retrieves a variable by name. If the variable is not found, returns null.

NoReturn SetVarByName(String name, Any val)
Sets a variable by name.

NoReturn SetVal(Record node, String name, Any val)
Sets the given field (name) on the given record.

NoReturn AddVal(Record node, String name, String title, Any val)
Works similarly to SetVal, but generates schema for the record if it is untyped. Honors the order of fields added, and provides a field title as well as name.

Any GetVal(RecordOrList src, String name)
Gets the given field (name) from the given record.

List MakeNumList(Number start, Number end, Number steps)
Returns a list of numbers from start to end, skipping steps on each iteration.

Any GetRequestParameter(String field)
Returns the value of the given request parameter, as taken from the current URL.

String GetAgentString()
Returns the agent string sent by the user's browser.

String GetBrowserReferrer()
Returns the referrer string sent by the user's browser.

Any GetRequestParameters()
Returns a list of all the request parameters in the URL.

List StringList(String list, String delim)
Splits the string into a list based on delimeter.

NoReturn ValidateScript(String script)
Validates the given script as a DbfScript. Throws an error if the script doesn't validate.

NoReturn ValidateExpression(String expression)
Validates the given expression as a DbfScript. Throws an error if the script doesn't validate.

NoReturn EMailUsersEx(List emailList, String subject, String htmlBody, List attachments)
Sends an email to the given list of user records, or list of email addresses. Attachments allows for a list of files to be attached to the email.

List EMailUser(Any ouser, String subject, String body, FileData attachment)
Sends an email to the given user record (ouser) or email address.

String GetDotNetVersion()
Returns the version of .Net that is installed on the server.

String GetAppVersion()
Returns the version of the application.

String CreateChecksum(Path path, Record node, String existingSig, String excludeFields)
Creates a checksum of the data (node) at path, supplying an existing checksum signature, and a list of fields to exclude (comma separated).

Any Eval(String script, Record input, Path path)
Evaluates the given DbfScript, with input becoming #input and path becoming &path.

String file:Load(String file)
Loads a file on the server (in the local Files folder of the server) and returns a string. Only certain files are allowed.

String file:SaveToFile(Any data)
Saves the given file data.

Boolean RunningAsSystem()
Returns true if the current script is running as admin.

FileData RunReport(Path path, String id)
Runs the given report (id) at the given path, and returns this in a file data object.

FileData RunReportPdf(Path path, String id, Record input, String filename)
Runs the given report (id) at the given path, and returns this in a file data object, formatted as PDF.

FileData RunReportAsFormat(Path path, String id, Record input, String filename, String format)
Runs the given report (id) at the given path, and returns this in a file data object, formatted in the given format (eg. PDF or HTML).

FileData RunReportWithInput(Path path, String id, Record input)
Runs the given report (id) at the given path, and given parameter data (input), and returns this in a file data object.

RecordOrList Find(RecordOrList seq, String field, Any val)
Finds the given value (val) in the field in the given list (seq).

Boolean Contains(String text, String substring)
Returns true if text contains the given sub-string.

String PostToUrl(String url, Any nameValuePairs, Number timeOutSeconds)
Performs an HTTP POST to send the given record of name/value pairs (nameValuePairs) to the given URL, with timeOutSeconds (eg. 30).

NoReturn SetCookie(String uri, String name, String val)
Sets the given cookie (uri/name) to val, when the script returns a page to the user.

Any GetCookie(String uri, String name)
Retrieves the value of the cookies stored on the user's browser session.

NoReturn ClearCookies()
Clears all cookies in the browser's session related to this site.

String LoadUrl(String url, Number timeOutSeconds)
Loads the given URL data, with the given timeout. Returns it as a string.

NoReturn tok:Load(String text)
Loads the given text and splits it into tokens that can be used by the tok functions.

String tok:LoadUrl(String text)
Loads text from the given URL into the tokenizer.

Number tok:GetBookmark()
Returns a bookmark to remember the current tokenizer location.

NoReturn tok:SetBookmark(Number obj)
Jumps to the given bookmark location in the tokenizer.

String tok:GetText(Number bookmark1, Number bookmark2)
Retreves the text between the two given bookmarks.

NoReturn tok:LoadEx(String text, Boolean indicateLines, String letterChars)
Loads the given text into the tokenizer, optionally recognizing line returns (indicateLines), and using letterChars to split tokens.

Boolean tok:Closer(String text1, String text2)
Returns true if text1 is closer in the tokenizer than text2.

Boolean tok:EOF()
Returns true if the tokenizer has reached the end-of-file.

Boolean tok:Exists(String text)
Returns true if the given text token is in the tokenizer.

String tok:Where()
Returns a line of text that shows where the current tokenizer cursor is.

Number tok:SkipTo(String text)
Skips the tokenizer cursor to the given text token.

NoReturn tok:SkipBackTo(String text)
Skips the tokenizer cursor back to the given text token.

String tok:Peek()
Retrieves the current token from the tokenizer without moving the cursor.

String tok:Next()
Retrueves the next token from the tokenizer.

NoReturn tok:BackOne()
Moves the tokenizer cursor back one.

Number tok:NextNum()
Retrieves the next token as a number.

DateTime tok:NextDate()
Retrieves the next token as a date.

String tok:NextTo(String text)
Retrieves the text between the cursor position and the next token that matches text.

NoReturn tok:MustBe(String text)
Checks that the next token is text, if not it throws an error, if it is then it moves the cursor on one.

Boolean tok:IsNext(String text)
Returns true if the next token is text.

String GetDropdownIcon(Record node, String fieldName)
Retrieves the icon ID associated with the dropdown entry for the value of field in the record.

List GetDropdownOptions(Record node, String fieldName)
Retrieves the dropdown options in a list for the dropdown held at fieldName in the given record.

String GetDropdownTitle(Record node, String fieldName)
Retrieves the display title associated with the dropdown entry for the value of field in the record.

List FindAllImages(Path cpath)
Returns a list of paths of all images that are held under records under the given path.

Number GetDropdownSortValue(Record node, String fieldName)
Retrieves the sort ID associated with the dropdown entry for the value of field in the record.

String GetSmallIconHtml(String iconID, String backColor)
Retrieves the icon HTML for the given icon ID with the given background color.

Record CreateActionInput(String actionName, Path where)
Createa a record suitable for input into the given task/action at the given path.

String GetWebServerName()
Retrieves the web server name as specified in the configuration tab.

String str:HtmlEncode(String text)
Returns the text suitable for inclusion in HTML.

String str:HtmlDecode(String text)
Returns the text HTML encoded text as regular text.

List Merge(RecordOrList onewData, Path targetPath)
Merges data (onewData) into the given path.

List data:RunODBC(String connection, String command)
Runs an ODBC query (command) at the given connection string, and returns the data as a list.

List LoadSpreadsheet(String text)
Loads the given spreadsheet (tab-separated) text and returns a list of typeless data.

String LoadTextFile(String file)
Loads text from the given path and returns it as a string.

String GetMachineName()
Returns the name of the server machine.

List RemoveFromList(List seq, Record rec)
Removes the record (rec) from the list (seq).

FileData CreateFile(String text)
Creates a new file data object.

List LoadSpreadsheetEx(String text, Path path, Any type, Boolean strictConversion)
Loads the given text as a spreadsheet (tab separated) for inserting into path. The format (type) should be TSV or CSV. Apply strict conversion to enforce types in the input data.

String SaveToSpreadsheet(List seq)
Saves the given list as a text string of TSV data, which is returns.

List LoadSpreadsheetAt(String text, Path path)
Load the given text as a TSV spreadsheet for inserting into the given path.

Record ImportXmlData(FileData fd, Path path)
Loads XML data from the given file data object into the given path, and return the record object.

Record ImportXmlDataEx(FileData fd, Path path, Boolean forceNewIDs)
Loads XML data from the given file data object into the given path, and return the record object. Optionally enforce new IDs or use the original IDs.

Boolean ValidateIdentifier(String ident)
Checks that the given text is a valid identifier for use in DbfScript.

Path ExtractPath(Path origPath, Path pathLikeThis)
Takes the path origPath and returns the portion of that path up to the part that matches the type specified in pathLikeThis.

Path GetPathByRecID(Path typePath, Number recID)
For the given type (pointed to by typePath) and the given counter ID (recID), returns the path to the record that has that counter ID.

Path Parent(Path path)
Returns the parent of the given path.

Path ClearPredicates(Path path)
Removes the predicates from the end of the given path.

Path AddPath(Path path, String item)
Add the given path item (item) to path.

String RecordToXml(Record node)
Converts a record to XML format.

Record RecordFromXml(String xml, Path path)
Converts the XML to a record, with path specifying the type to use.

Boolean ValidateCreditCard(String cardNumber)
Validates a credit card number.

String ListToJSON(List seq)
Converts a list to JSON format.

List ListFromJSON(String json, Path path)
Converts JSON to a list, for inserting into the type at path.

String RecordToJSON(Record node)
Converts a record to JSON format.

Record RecordFromJSON(String json, Path path)
Converts JSON to a record, for inserting into the type at path.

NoReturn SetCounterSeed(Path path, Number num)
Sets the counter starting number for the type at the given path. The next record inserted at that point will then use that counter number. Note: this may cause duplication errors if records already exist with that counter number. Care must be taken.

NoReturn ClearSelection()
Clears the user's selection of records, if any.

String WikiFormat(String wiki)
Converts wiki formatted text to HTML.

Any Nothing()
The same as null.

Any NoLink()
Returns a no-link value. Use to reset a link field.

String GetFileText(FileData file)
If file is a text file, returns the contents of that text file as a string.

String GetFileName(FileData file)
Returns the file name of the file associated with the given file data object.

String GetFileContentType(FileData file)
Returns the content type associated with the given file data object.

NoReturn SetFileName(FileData file, String name)
Sets the filename of the given file data object.

NoReturn SetFileContentType(FileData file, String contentType)
Sets the content type of the given file data object.

Boolean HasRole(String role)
Returns true if the current user has the given security role.

Record GetUser()
Returns the user record associated with the current user.

String UserRef()
Returns a link to the currently logged-in user.

String UserName()
Returns the User ID of the currently logged-in user.

String DescribeNode(Record node)
Returns a text representation of the given record.

String HtmlNode(Record node)
Returns HTML-formatted representation of the given record.

Path GetFriendlyPath(Path path)
Returns a user-friendly representation of the given path.

String DescribePath(Path path)
Returns a long representation of the given path.

String NewGuid()
Returns a new UUID (universally-unique identifier).

Boolean Exists(Any src)
Returns true if the given value is not null, or otherwise holds a substantial value.

Boolean NotExists(Any src)
Returns true if the given value is null or holds an unsubstantial value.

String GetTime(DateTime date)
Returns the time portion string for the given date.

DateTime SetTime(DateTime date, String time)
Sets the time portion of the given date.

DateTime SetDayOfMonth(DateTime date, Number day)
Sets the day of the month for the given date.

DateTime SetMonth(DateTime date, Number month)
Sets the month portion of the given date.

String str:Substring(Any str, Number start, Number len)
Returns a portion of the given string (start, for len characters).

String str:CropString(Any str, Number len)
Crops the string to the given length. If it exceeds the length, adds an ellipses to the end.

String str:SubstringRight(Any ostr, Number len)
Returns len characters from the end of the string.

Number str:Length(Any ostr)
Returns the length of the given string.

String str:CharAt(Any ostr, Number index)
Returns the character at index in the given string.

Boolean str:IsDigit(Any ostr)
Returns true if the given character is a digit.

Boolean str:IsLetter(Any ostr)
Returns true if the given character is a letter.

Boolean regex:IsMatch(String source, String pattern)
Performs a regular expression match on source using the given pattern. Returns true if it matches.

List regex:Matches(String input, String pattern)
Performs a regular expression match on source using the given pattern. Returns the matches.

List regex:Filter(List source, String field, String pattern)
Performs a regular expression filter on source using the given pattern.

String regex:Replace(String source, String pattern, String replacement)
Replaces all occurrences that match pattern in source with replacement.

String[] regex:Split(String source, String pattern)
Splits the source string into a list based on matches to pattern.

Number regex:Match(String source, String pattern)
Returns the number of matches of pattern in source.

Record RunSearchEngineQuery(String query, Number page, Path path)
If the search engine is enabled in the web application, runs a text search under the given path and returns the results in a record. If multiple pages are returned, access the next page using the page number.

List GetGoverningUsersFor(Path path)
Returns the governing users (as per the security workflow) for a given path, if any are defined.

String GetFormUpdatePostUrl(Path path, Path fromPath, String fromScreen)
Retrieve the URL for posting data to update data from a form. For use in custom skins.

String GetFormHtml(Path path, String returnUrl)
Retrieve the form HTML for posting data to a WorkflowFirst application. For use in custom skins.

String GetFormHtmlForAction(Path path, String actionName, Boolean isGlobal, String returnUrl)
Retrieve the form HTML for running an action in a WorkflowFirst application. For use in custom skins.

String ActionLink(Path path, String actionID, String returnURL)
Returns the URL link to run a particular action.

String ViewLink(Path path)
Returns the URL to view the data record at a given path.

String ScreenLink(Path path, String screen)
Returns the URL to view the data, and custom screen, for a given path.

String EditLink(Path path, String fromLink)
Returns the URL to edit the data record at the given path.

String CreateLink(Path path, String fromLink)
Returns the URL to create a new data record at the given path.

String ViewLinkWithHost(Path path)
Returns the URL to view the data record at a given path, including the web server host name.

String MakeLink(String title, Path path)
Returns a string suitable for assigning to a link field, pointing to a given path, showing a specific title.

Any Item(RecordOrList seq, Number index)
Returns the item in a list at the given index. 1-based.

Any FireEvent(Path path, String eventType, Record inputData)
Forces the raising of the given event type (Change, InlineChange) at the given path, with the given input data.

NoReturn Assert(Boolean b, String error)
If the first parameter doesn't evaluate to true, then raises the given error text as an error

String GetCType(Any ds)
Returns the type name of the given record.

Boolean HasCTypeField(String typeName, String field)
Returns true if the given type name has the given field.

List GetCTypeFields(String typeName)
Returns a list of fields in the given type name.

List GetRoles()
Returns a list of the roles the user has.

List GetCTypes()
Returns a list of all the types in the system.

NoReturn SetPath(Record node, Path path)
Sets the path of the given record.

Path GetPath(Any oval)
Returns the path of the given record or link.

Path GetPathSafe(Any oval)
Gets the path of the given record or link, and returns a valid root path if the path is not set.

List PointersTo(Path path, Path typeName, String foreignField)
Returns a list of paths that point (through link fields) to the given path, for the given typename and link field name.

String GetDisplay(String val)
Gets the display portion of a link field.

DateTime AddDays(DateTime dateTime, Number days)
Adds the given number of days to the given date, and returns a new date.

DateTime AddMonths(DateTime dateTime, Number months)
Adds the given number of months to the given date, and returns a new date.

DateTime AddMinutes(DateTime dateTime, Number mins)
Adds the given number of minutes to the given date, and returns a new date.

DateTime AddSeconds(DateTime dateTime, Number secs)
Adds the given number of seconds to the given date, and returns a new date.

DateTime Today()
Returns today's date, without a time portion.

DateTime UtcNow()
Returns the current UTC time.

DateTime DateOnly(DateTime date)
Returns the date-only portion of a date time value.

Boolean IsHoliday(String selectedHolidaySchedule, DateTime date, Boolean includeWeekends)
Returns true if the given date lies on a holiday, using the given holiday schedule link value. Optionally include weekends in this determination.

DateTime MaxDate()
Returns the maximum date that the system can hold.

DateTime MinDate()
Returns the minimum date that the system can hold.

DateTime NullDate()
Returns an empty date field.

Number Year(Any expr)
Returns the year portion of the given date value.

Number Month(Any expr)
Returns the month portion of the given date value.

Number Day(Any expr)
Returns the day of the month portion of the given date value.

Number DayOfWeekAsNumber(Any expr)
Returns the day of the week portion of the given date value.

Number ProrateToEndOfMonth(Number amount, Any date)
Prorates the given number (per month) from the given date to the end of the month.

Number DaysBetween(Any odate1, Any odate2)
Return the days between the two dates.

Number MonthsBetween(Any odate1, Any odate2)
Returns the months between the two dates.

Number SecondsBetween(Any odate1, Any odate2)
Returns the seconds between the two dates.

Number TicksBetween(Any odate1, Any odate2)
Returns the milliseconds between the two dates.

Number Hour(Any odate1)
Returns the hour portion of the given date.

Boolean ValidateTime(String time)
Validates that the given time string is a valid time.

String FormatHours(Any expr, String format)
Formats the given date value for display as hours. Currently the only format supported is "c", which returns for example "1d 1h 1m".

String FormatDate(Any expr, String format)
Formats the given date using the given standard date format string.

Number GetNumber(Any expr)
Converts the given value into a number.

String FormatNumber(Any expr, String format)
Formats the given number value using the given standard number format string.

String FormatDouble(Any expr, String format)
Formats the given number value using the given standard number format string.

Any GetReturnValue()
Retrieves the last value set as the return value in the script.

Record domain:GetProperties(String domain, String domainAdminUser, String domainAdminPassword)
Retrieves the LDAP properties for the given domain, using the given domain admin user and password.

NoReturn domain:ChangePassword(String domain, String user, String oldPassword, String newPassword, String domainAdminUser, String domainAdminPassword)
Changes the password for a user on the given domain.

NoReturn domain:Update(String domain, String user, Record data, String domainAdmin, String domainPassword)
Updates the propertues of a user record on a domain according to the values in data.

Record domain:GetUser(String domain, String user, String password, String domainAdminUser, String domainAdminPassword)
Returns the user record on the given domain.

NoReturn domain:CreateUser(String domain, String user, String pass, Record data, String domainAdmin, String domainPassword)
Creates the given user (properties in data) on the given domain.

Number Round(Any expr)
Rounds the given number value to the nearest whole number.

Number RoundTo(Any expr, Number decPlaces)
Rounds the given number value to the nearest number of decimal places.

Number Random(Number min, Number max, Number decPlaces)
Returns a random nuber between min and max, rounded to decimal places.

Record math:GetStandardDeviationTS(List list, String dateField, String valueField)
Returns the standard deviation from the given list, with dateField holding the date and valueField holding the number.

Number math:Pow(Number val, Number exp)
Returns value raised to the power of exp.

Number math:Abs(Number val)
Returns the absolute value (removing the sign) of val.

Number math:Mod(Number val, Number mod)
Returns val moduluo mod of the given number.

Number math:XIRR(List cashFlows)
Calculates the internal rate of return (IRR) of the given cashflows. List must contain records containing Value and Date fields.

Number Trunc(Any expr)
Truncates the given numeric value, removing any fractions (not rounding).

DateTime Date(Any expr)
Returns the date value of a given string value.

DateTime DateAndTime(Any expr)
Returns the date and time value of a given string value.

String DateStr(Any expr)
Converts the given date value into a string, using the default formatting.

DateTime Now()
Returns the current date and time.

Number Double(Any expr)
Converts the given string expression to a number.

Boolean IsUserAdmin()
Returns true if the current user is an administrator.

Any GetDataByNameForDisplay(Record node, String field)
Retrieves the value (field) from the given record (node), formatted in a way that is suitable for display to the user.

String GetAppName()
Returns the application name.

String GetAppTitle()
Returns the application title.

String FileLink(Path path)
Returns a URL that provides a link to download the file in the given path. The last field of the path must be the file field.

RecordOrList Top(List expr, Number count)
Returns the top (count) items from the list expr.

String HtmlEncode(String text)
Encodes the given text for use in HTML.

String HtmlDecode(String text)
Decodes HTML-encoded text.

IEnumerable SortStringList(IEnumerable list, Boolean ascDesc)
Sorts the given list of strings alphabetically.

RecordOrList Sort(List expr, Any field, Boolean sortDir)
Sorts the given list (expr) by field, ascending (sortDir=true) or descending (sortDir=false).

RecordOrList SortEx(Any expr, String field1, Boolean sortDir1, String field2, Boolean sortDir2, String field3, Boolean sortDir3)
Similar to Sort, but allows the use of up to 3 keys that are combined.

String GetTitle(Any expr)
Returns the title of the given record, presuming a title field is defined.

String DecodeURL(Any expr)
Decodes the given URL-encoded string.

String JSSafe(String text)
Returns the string suitable for inclusion in Javasript.

String URLSafe(Any expr)
Encodes the given string for use in a URL.

Number Count(Any expr)
Returns the number of items in the given list of record.

Number Sum(Path path)
Sums the values of the records pointed to by path, with the last item of the path being the field to sum.

Any Max(Any expr)
Returns the max of the values of the records pointed to by path, with the last item of the path being the field to use.

Any Min(Any expr)
Returns the minimum of the values of the records pointed to by path, with the last item of the path being the field to use.

Number Average(Any expr)
Returns the average of the values of the records pointed to by path, with the last item of the path being the field to use.

List List(List seq, String field)
Retrieves the values of field in the list seq, and returns a new list of those values only.

Number SumField(RecordOrList seq, String field)
Performs a sum on the value of field in the records in seq.

List Filter(List seq, String field, Any val)
Creates a new list of all items in seq where field is equal to val.

List Group(List seq, String key, String aggregateFunc, String aggregateFields)
Groups the given list (seq) by the given key. Performs the aggregate function (must be "SUM" at present) on the given aggregate fields, which must be forward-slash separated.

List UniqueList(List seq, String field)
Returns a unique list of values held in field in each record in seq.

RecordOrList CropList(Any seq, Number num)
Crops the given list to be only num in length.

Any Clone(Any obj)
Clones the given record so it can be changed independently of the original record.

String DescribePathSimple(Path cpath, Number start, Number end)
Returns a simple description of the given path, starting at start and ending at path item end.

Path path:CropPath(Path path, Number size)
Crops the given path to the given number of items (size).

Number path:PathLength(Path path)
Returns the number of path items in the given path.

CPathItem path:GetLastPathItem(Path path)
Returns the last path item as a special object.

String path:GetPathItemName(CPathItem item)
Returns the name of the special path item.

NoReturn path:AddPredicate(CPathItem item, String field, String op, Any val)
Adds a predicate (fied, op (eg. "="), val) to the given special path object.

List path:GetPredicates(CPathItem item)
Returns a list of predicates on the given special path object.

Path path:CropToPath(Path cpath, String pathItem)
Crops the given path up to the given path item.

String path:GetIDPredicate(CPathItem item)
Returns the value of the ID predicate on the given special path object.

String IPAddress()
Returns the IP address of the user.

Any IIf(Boolean condition, Any result1, Any result2)
If condition is true, returns result1, otherwise returns result2.

NoReturn workflow:SetStage(Record rec, String workflowName, String stageName)
Sets the given record to be at the specified workflow stage, for the given workflow (workflowName). This will send out notifications for those who have subscribed.

NoReturn workflow:AddAssignment(Path path, String roleID, Record user, String workflowStage, String notes)
Adds an assignment to a record. Assigns the record to either a given security role ID, the given user, or both. Optionally specify the specific workflow stage (workflowName + stage ID), or leave blank. Optionally specify notes which the user will be emailed, and will see when they visit the record.

NoReturn workflow:RemoveAssignment(Path path, String roleID, Record user, String workflowStage, Boolean removeViewBy)
Removes the specified assignment from a record. Removes all assignments that match the given roleID, user and optionally workflowStage. Optionally (removeViewBy=true) will remove the view filter for this user.

All Functions - WorkflowFirst Customer Support Server, Version 1.0.849 (beta)
[ Client.Wiki, Professional ]
Up Since 7/21/2019 9:10:54 PM