1. General information

  • Server functions are used to invoke program code executed on the server side. The result of a server function call is always a value represented as a text string.
  • Server functions may be used during application design only by administrators. Regular users do not have direct access to invoking server functions from the application user interface; server functions are always executed only indirectly through applications designed by administrators. The exception is the “EVAL” function over a value that a regular user can change: it also evaluates the functions that the user wrote into it (see the description of the “EVAL” function). Similarly, a regular user can influence an “ngef2” call stored in a control whose value the user can change in the form or by importing data into a view table (see the description of the “ngef2” function).
  • The description of every function includes a “Use” field that specifies where the call may be written — in an HTML control, in a script line, in client-side JavaScript, in the “Notes” field, and so on. A function intended for one use may not work elsewhere.
    • The content of the RichText control entered directly as text is evaluated in the same way as the content of the HTML control, so functions whose “Use” field lists “HTML” can be written in formatted text as well. Text that the control loads by a database query is not evaluated.
    • Functions whose “Use” field lists “HTML” are also evaluated in the default value of a control, in the expression appended to the result of the aggregate function of the “AutoSum” control, in the values of the conditions of a database query, in the default “From” and “To” values of the time span of a database query, in the values of selection controls, in the abbreviated name of a database control, in the name of the “HTML” control, in the text of the “Title” and “Tab” controls, in the name of the “Chart” control, in the list of resources of the “Kanban” and “Planner” controls, in the column names and in the additional header rows of a statistical view table, in the initial value of the number series of the “Max + 1” default values, in the address of a view page of the “Show web page” type, in the condition of the “Holidays.txt” configuration file and in the copyright of the navigation area specified by the “Copyright.txt” configuration file, unless its content begins with the “©” character and a space.
  • Some functions are not available in the NET Genium Online cloud edition — mainly functions that work with files on the server disk (including creating attachments), export or import data in bulk, or interfere with the operation of the server. The description of such a function includes a “Restriction” field. The script designer does not offer such a function in the list of functions, and its call is not evaluated in the cloud edition — it stays in the text as an unevaluated call (see chapter 1.6.). The exceptions are the “OCR2FILE”, “OCR2HTML” and “OCR2TEXT” functions, whose call with a file path ends with an error in a script in the cloud edition; the “OCR2HTML” and “OCR2TEXT” functions return the error text elsewhere instead.

1.1. Writing a call

Parameters are enclosed in parentheses and separated by commas. Functions that do not accept any parameters must always be called with parentheses. The exceptions are the functions written in the name of an HTML control (e.g. “CENTER” or “NOBACKGROUND”), which are written there without parentheses; the notation is given in the description of the function concerned.

TEMPPASSWORD()
LOWER(ABC)
SUBSTRING(abcdef, 0, 3)

There must be no space between the function name and the opening parenthesis, otherwise the call is not evaluated. Only the letters and digits immediately before the parenthesis are taken as the function name. A function is therefore evaluated even if its name is preceded by another character, for example an underscore, a dot or a hyphen – the notation “x_UPPER(abc)” is evaluated as a call to the UPPER function. This must be kept in mind in JavaScript, where a call to a method or function with the same name that is preceded by a dot, an underscore or a character other than a letter or digit is also evaluated as a server function (for example “obj.upper(abc)”).

A parameter of the logical type (“bool”) is true only with the value “true”; the letter case does not matter. Any other value, for example “1” or “yes”, means false.

The number of days, hours, minutes, months or years added by the “ADDDAYS”, “ADDHOURS”, “ADDMINUTES”, “ADDMONTHS”, “ADDWORKDAYS”, “ADDWORKHOURS” and “ADDYEARS” functions is evaluated as an arithmetic expression, for example “ADDDAYS(#today#, #A# * 7)” in a script. Only the leading complete expression is evaluated and the text after it is discarded – for example “ADDHOURS(#now#, 1:30)” adds one hour. A value from which no expression can be evaluated counts as “0”. A resulting date outside the range of the data type ends with an error (see chapter 1.6.). The “skipholidays”, “starthour” and “endhour” parameters are not evaluated as an expression; a value that is not a whole number (including a number outside the range of the data type) means “0”.

The mathematical functions “ABS”, “ARCCOS”, “ARCSIN”, “ARCTAN”, “COS”, “EXP”, “LOG10”, “POWER”, “ROUND”, “SIN”, “SQUARE” and “TAN” return a decimal number with the decimal separator according to the language of the logged-in user – with a decimal comma for a user with the Czech language and with a decimal point for a user with the English language. The examples of these functions in this guide show the result for the Czech language.

1.2. Letter case in the function name

The function name is written exactly in the form in which it is listed in the list of server functions in chapter 2. For most functions this is upper case, the ngef and ngef2 functions are listed in lower case.

For most server functions the letter case is irrelevant — “SUBSTRING(abcdef, 0, 3)”, “substring(abcdef, 0, 3)” and “Substring(abcdef, 0, 3)” are equivalent. For some functions, however, the prescribed form is binding, usually because the function name matches a JavaScript construct that must be preserved for the browser. The following functions have a binding form of the name:

  • upper case only: BUTTON, COPILOTCHAT, DATE, EVAL, GANTT, HTMLDECODE, HTMLENCODE, INT2TIME, MINUTES2TIME, REMOVEDIACRITICS, REMOVETAGS, REMOVEWHITESPACES, SECONDS2TIME, SPLIT, TIME2INT, TIME2MINUTES, TIME2SECONDS, URLDECODE, URLENCODE,
  • exactly in the listed form: DateArray, DoubleArray, EmailArray, IntegerArray, LongArray, StringArray, ngef2.

For other functions (e.g. ROUND, TRIM, INDEXOF) only a notation that matches a JavaScript construct is not evaluated; this restriction is stated in the description of the function concerned. This also applies to the TRANSLATE function, whose notation “translate(” in lower case is not evaluated in JavaScript, in the content of the HTML, RichText and Title controls of an edit form, on a view page, in a portlet on the main page that displays an HTML or RichText control and in the copyright of the navigation area specified by the “Copyright.txt” configuration file unless it is preceded by a letter, a digit, an underscore, the “$” character, a dot, a quotation mark, an apostrophe or a hyphen, or stands in a CSS “transform:” declaration.

NET Genium recognizes the functions written in the name of an HTML control (e.g. “CENTER”, “NOBACKGROUND” or “WEBFORM”) only if the whole name of the control matches them, including the letter case. They are therefore written exactly in upper case as listed in chapter 2 and without any other text (the exception are the parentheses of the “/TABLE” and “/DIV” functions, see their description).

NET Genium searches for the functions written in the “Notes” field of an edit form or a view page (e.g. “CENTER()”, “FULLAJAXMODE()”, “LABELSINSIDE()”, “LAYOUT()” or “MARGINS()”) in the note case-sensitively. They are therefore written exactly in upper case as listed in chapter 2; any other notation has no effect.

The functions written in the “Notes” field of a database control or a database query (e.g. “CONTROLINDETAILS()”, “LABELPOSITION()” or “PRINTCOLUMNS()”) are also written exactly in upper case as listed in chapter 2. For some of them NET Genium does not recognize any other notation.

1.3. Spaces around parameters

White-space characters (spaces, tabs and line breaks) at the beginning and at the end of every parameter are removed before evaluation. The expressions “SUBSTRING(abcdef,0,3)” and “SUBSTRING( abcdef , 0 , 3 )” are therefore equivalent, and spaces may be used to make the call easier to read.

Only spaces written directly in the call are removed. Spaces in a value substituted into the parameter for a variable or for the result of a nested call are preserved. The trimming functions therefore take effect over a variable or a nested call, not over text written directly in the parameter.

TRIM( abc )
// Returns “abc”; the spaces were already removed by parameter processing and the TRIM function has no effect
TRIM(#ng_prijmeni#)
// Returns the value of the “Surname” field without leading and trailing spaces
TRIM(" abc ")
// Returns “abc”; the quotation marks preserved the spaces and the TRIM function removed them

If a parameter begins or ends with a space, it must be enclosed in double quotation marks.

1.4. Double quotation marks

A parameter may be enclosed in double quotation marks. The quotation marks delimit the parameter and are not part of its value. A parameter must be enclosed in quotation marks in three cases:

  • the parameter contains a comma character that would otherwise be evaluated as a parameter separator,
  • the parameter begins or ends with a space,
  • the parameter contains an unpaired parenthesis.
REPLACE("a, b, c", ",", ";")
// Returns “a; b; c”; without the quotation marks the commas would split the call into more parameters

The quotation marks also change how the content of the parameter is processed. Inside quotation marks variables are not replaced and nested function calls are not evaluated — the function processes the text in its literal form.

LOWER(#ng_prijmeni#)
// Returns the surname in lower case
LOWER("#ng_prijmeni#")
// Returns the surname unchanged; the function processed the literal text “#ng_prijmeni#” and the variable was substituted only after the function had been evaluated

The SQL, SQLARRAY, SQLTABLE, EVAL, FORMATDATATABLE, FORMATDATAVIEW, EXPORTDATATOXMLATTACHMENT, EXPORTDATATOXMLFILE, EXPORTFORMDATATOXMLATTACHMENT and EXPORTFORMDATATOXMLFILE functions and the COLORLEGEND function with a single parameter, if it is a database query, are an exception. Their parameter with the database query (for the EVAL function the parameter with the expression) is often enclosed in quotation marks because it contains commas, yet variables and nested server function calls are still evaluated inside it.

SQL("SELECT ng_nazev FROM ng_firma WHERE id = #ng_idfirma#")

It is recommended to always enclose the parameter with the database query in quotation marks, even if the query contains no commas.

The quotation marks are removed from the value of the parameter and its content is processed literally only if they enclose the whole parameter and there is no other quotation mark inside it. In other cases – for example when further text follows the closing quotation mark – the quotation marks remain part of the value of the parameter, variables are substituted in it and nested calls are evaluated unless they stand inside the quoted part; a comma is, however, protected from splitting the parameters by every pair of quotation marks. A quotation mark inside a parameter therefore cannot be written by doubling it. Characters with a special meaning in the notation of a call are inserted using variables:

  • #comma# — comma
  • #doublequotes# — double quotation mark
  • #sharp# — hash character
  • #crlf# — line break
  • #tab# — tab

1.5. Variables and nested functions in parameters

A parameter may be a variable or a call to another server function. Nested calls are evaluated from the inside out and their result is substituted into the parameter as text. In an edit form, in the content of the HTML, RichText, Title and JavaScript controls, in the JavaScript of control events and buttons (including the “Save”, “Delete” and “Back” buttons of the “ActionButtons” control), in a default value of the “JavaScript” type and in the custom text of the “Save and new” button the variable “#ng_...#” is replaced by a reference to the control before the functions are evaluated, even inside double quotation marks; the value of the control is passed into a function parameter by the notation “#ng_...:value#”. A detailed description of variables is provided in the separate guide Variables.

UPPER(SUBSTRING(#ng_prijmeni#, 0, 1))
// Returns the first letter of the surname in upper case
ADDDAYS(#today#, 7)
// Returns the date one week from today

The content of the HTML, RichText and Title controls in an edit form, the content of the JavaScript control in an edit form and on a view page, the JavaScript of control events, the “Client” field of a button, the JavaScript of the “Save”, “Delete” and “Back” buttons of the “ActionButtons” control, a default value of the “JavaScript” type and the custom text of the “Save and new” button are evaluated in the same way as JavaScript: the “SQL” function with a query that returns more columns returns the first row of the result as a JavaScript array, and notations that are not evaluated in JavaScript (the “REPLACE” function written in lower case and the “EMAIL” function written in lower case with an empty parameter) stay in the text unevaluated. The content of the HTML, RichText and Title controls on a view page is not evaluated in this way.

A substituted value is not split into parameters again. If it contains a comma, the number of parameters of the call does not change. The depth of nesting is limited: the outer call and at most five levels of calls nested in its parameters are evaluated. A call at the fifth level of nesting is still executed, but its parameters are no longer evaluated and the function processes them as literal text.

After the evaluation, the result of a function is processed by the replacement of variables in the same way as the surrounding text. If the returned value contains the notation of a variable “#...#” – for example in data loaded by the “SQL” function –, the variable is substituted into it. Print templates in the TXT, CSV and HTML formats are an exception, as is text with a call of the “OCR2HTML” or “OCR2TEXT” function, in which variables are not substituted at the level of the call or at the higher levels of the expression; only variables in parameters of other functions outside double quotation marks that do not contain a call of these functions themselves are substituted.

1.6. A call that is not evaluated

A call that cannot be evaluated is left in the text and no error message is displayed; the notation of the call appears in the output, with the results of nested functions already substituted into its parameters – the notation “xxxUPPER(LOWER(ABC))” is output as “xxxUPPER(abc)”. This happens in the following cases:

  • the function name does not match any existing function,
  • the number of parameters does not match any variant of the function (the “ADDDAYS” and “ATTACHMENTGALLERY” functions, however, accept additional parameters too – “ADDDAYS” looks for the “sat” and “sun” values in all parameters from the fourth one and “ATTACHMENTGALLERY” for the “zoom” value in all parameters from the fifth one),
  • the function has a binding form of the name and is written differently (see chapter 1.2.),
  • the parentheses of the call are not paired – parentheses inside double quotation marks are not counted, so even a single double quotation mark in a parameter of the call excludes it (for example in the size notation 24"); a double quotation mark in the value of a parameter must be inserted with the “#doublequotes#” variable,
  • the text before the call contains an odd number of double quotation marks – they are counted from the beginning of the text or from the end of the previous pair of matching round brackets that is not itself within quotation marks (even if it is not a function call), and only their number matters, so even a single double quotation mark in the text before the call excludes it (for example in the size notation 24") and apostrophes do not protect the call,
  • the function reads a database query and the query does not pass the check of the query notation described for the “SQL” function – this applies to the “SQL”, “SQLARRAY”, “SQLTABLE”, “FORMATDATATABLE” and “FORMATDATAVIEW” functions (the “EXPORTDATATOXMLATTACHMENT”, “EXPORTDATATOXMLFILE”, “EXPORTFORMDATATOXMLATTACHMENT” and “EXPORTFORMDATATOXMLFILE” functions only omit such a query and create the file or attachment without it, see their description),
  • the function is written elsewhere than its “Use” field states – for example a function intended for a comment line of a script in another script step (a few such functions are executed there anyway) or in an HTML control, a function intended for an edit form on a view page, or a function with the “Restriction” field in the NET Genium Online cloud edition,
  • the function is not executed in a test run of the script (this applies mainly to functions that write to the database, create attachments, send messages or schedule actions after the script finishes); some of them return a placeholder value in a test run instead – for example the “COPYATTACHMENT” function returns “0” and the “READURL” function with a valid address an empty string,
  • NET Genium runs in demo mode (the “Demo.txt” configuration file) or in the read-only mode of NET Genium Online and the script does not run in an edit form in which changes are allowed; functions that write to the database, create attachments or send messages are then generally not executed, just as in a test run, but in demo mode the “COPYATTACHMENT” function with one parameter returns the ID of the original attachment instead of “0” (in NET Genium Online it is not evaluated at all),
  • the script runs without a web request (a scheduled task run by the “RunScript.exe” program) and the function works with the request or with the page of the browser – this applies for example to the “REQUESTFORM”, “REQUESTQUERYSTRING”, “SETCOOKIE”, “FLUSHFILE”, “HIDEFORM” and “SETQUERYCOLUMN” functions; the “GETCOOKIE” function returns an empty string in such a script.

A few functions do not stay in the text with an incorrect number of parameters but return a value: the “NGDPH” function returns “0” with three parameters, the “NGVAT”, “NGVATRATES” and “GETCOOKIE” functions an empty string. Conversely, some functions without parameters (for example “COMMIT”, “SKIPSAVE” or “TEMPPASSWORD”) are executed even with one specified parameter, which they ignore: empty parentheses are processed as one empty parameter and these functions do not check the content of the only parameter, so the notation “TEMPPASSWORD(x)” is evaluated in the same way as “TEMPPASSWORD()”.

Parameters are evaluated before the function itself. Variables and nested calls in the parameters of a call that is not evaluated are therefore evaluated and executed even though the outer function is left unevaluated. This also applies to a function disabled by renaming it (e.g. with the prefix “xxx”): in the notation “xxxWRITEMESSAGE(ngef(Function))” the external function is still called.

The most common causes are an incorrect number of parameters and a typo in the function name.

A function that is evaluated and ends with an error does not stay in the text: in a script it terminates the whole script, and in an HTML, RichText or JavaScript control, in the text of the “Title” and “Tab” controls, in the name of the “Chart” control, in the list of resources of the “Kanban” and “Planner” controls, in the default value of a control specified as text, in the list of values of a selection control, in the default “From” and “To” values of the time span of a database query, in the abbreviated name of a database control, in the name of the “HTML” control, in the column names and in the additional header rows of a statistical view table and in the condition of the database query of a view table and of other controls displaying data (for example a tree and a history, but not a chart) it terminates the loading of the whole page; in the copyright of the navigation area specified by the “Copyright.txt” configuration file it terminates the loading of the navigation area (if the navigation area is rendered inside the page, of the whole page). If the “Fill in the default value before each saving of the record to the database” check box of a control is selected and the “Fill in the default value every time the edit form opens up” check box is not, an error in the default value of an existing record appears only when the record is saved: the record is not saved and an error message is displayed to the user. An error in the default value of the “DatePicker” control, on the other hand, is not reported and the control gets the current date (a control with time also the current time); an error in the initial value of the number series of the “Max + 1” default values is not reported and the number series starts as without the initial value; an error in the expression appended to the result of the aggregate function of the “AutoSum” control is not reported, it is written to the “Errors” log and the result of the aggregate function without the expression is used; an error in the condition of the query that fills the values of a selection control replaces the values of the control with a single item “Error!”. Some functions do not raise the error and return the error text instead of the result – for example the “SQL”, “SQLARRAY”, “SQLTABLE”, “FORMATDATATABLE”, “FORMATDATAVIEW” and “SEARCHFILES” functions.

2. Server functions

string ABCXYZ(string callback)

Use: HTML

Description: The function displays an alphabetical bar with Czech characters (A–Ž) as a list of clickable links. When a letter is clicked, the JavaScript function specified by the “callback” parameter is called with the link and the selected letter as arguments. The default callback name (if the “callback” parameter is empty) is “abcxyz”. The bar automatically adjusts spacing for mobile devices.

Example:

ABCXYZ(filterByLetter)
// Displays the alphabet; clicking “P” calls filterByLetter(this, 'P')
ABCXYZ(abcxyz)
// Displays the alphabet with the default callback abcxyz
ABCXYZ()
// Displays the alphabet with the default callback abcxyz (empty parameter)
 

double ABS(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the absolute value from the value specified by the “number” parameter. The result is always a non-negative number regardless of the sign of the input. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

ABS(-1.23)
// Returns “1,23”
ABS(5.67)
// Returns “5,67”
ABS(0)
// Returns “0”
ABS(#A# - #B#)
// Returns the absolute difference of the values of the script variables A and B (in a numeric expression of a script)
 

DateTime ADDDAYS(DateTime date, double days)

Use: HTML, JavaScript, Script

Description: The function adds the number of days defined by the “days” parameter to the date specified by the “date” parameter. The “days” parameter can also be negative (subtracting days) or decimal (adding hours and minutes). For an invalid date it returns an empty string.

Example:

ADDDAYS(1.1.2000, -1.2)
// Returns “30.12.1999 19:12”
ADDDAYS(1.1.2000, 0)
// Returns “01.01.2000”
ADDDAYS(1.1.2000, 2)
// Returns “03.01.2000”
ADDDAYS(1.1.2000, 0.5)
// Returns “01.01.2000 12:00”
ADDDAYS(#today#, 7)
// Returns the date one week from today
 

DateTime ADDDAYS(DateTime date, double days, int skipholidays)

Use: HTML, JavaScript, Script

Description: The function adds the number of days defined by the “days” parameter to the date specified by the “date” parameter. The “skipholidays” parameter, which can be any integer, indicates that holidays will be skipped. If the “skipholidays” parameter is non-zero and the resulting date falls on a public holiday lasting the whole day, on a Saturday or on a Sunday, the function repeatedly adds “skipholidays” days (a negative value subtracts them) until the resulting date no longer falls on such a day; if “skipholidays” is a multiple of seven, a date on a skipped Saturday or Sunday is moved by one day in the direction of its sign. Holidays between the initial and the resulting date are not skipped; working days are added by the “ADDWORKDAYS” function. For an invalid date it returns an empty string.

Example:

ADDDAYS(1.1.2000, -9.2, -2)
// Returns “22.12.1999 19:12”
ADDDAYS(1.1.2000, 0, 1)
// Returns “03.01.2000”
ADDDAYS(1.1.2000, 12, 0)
// Returns “13.01.2000”
ADDDAYS(#today#, 0, 3)
 

DateTime ADDDAYS(DateTime date, double days, int skipholidays, string satsun)

Use: HTML, JavaScript, Script

Description: The function adds the number of days defined by the “days” parameter to the date specified by the “date” parameter. The “skipholidays” parameter, which can be any integer, indicates that holidays will be skipped. If the “skipholidays” parameter is non-zero and the resulting date falls on a public holiday lasting the whole day or on a skipped weekend day, the function repeatedly adds “skipholidays” days (a negative value subtracts them) until the resulting date no longer falls on such a day; if “skipholidays” is a multiple of seven, a date on a skipped Saturday or Sunday is moved by one day in the direction of its sign. Holidays between the initial and the resulting date are not skipped; working days are added by the “ADDWORKDAYS” function. By default, Saturdays and Sundays are skipped; to prevent Saturday or Sunday from being skipped, the text “sat” or “sun” must be specified as the “satsun” parameter. For an invalid date it returns an empty string.

Example:

ADDDAYS(1.1.2000, -9.2, -2, sat)
// Returns “22.12.1999 19:12”
ADDDAYS(1.1.2000, 0, 1, sun)
// Returns “02.01.2000”
ADDDAYS(1.1.2000, 12, 0, sat)
// Returns “13.01.2000”
ADDDAYS(#today#, 0, 3, sun)
 

DateTime ADDDAYS(DateTime date, double days, int skipholidays, string sat, string sun)

Use: HTML, JavaScript, Script

Description: The function adds the number of days defined by the “days” parameter to the date specified by the “date” parameter. The “skipholidays” parameter, which can be any integer, indicates that holidays will be skipped. If the “skipholidays” parameter is non-zero and the resulting date falls on a public holiday lasting the whole day or on a skipped weekend day, the function repeatedly adds “skipholidays” days (a negative value subtracts them) until the resulting date no longer falls on such a day; if “skipholidays” is a multiple of seven, a date on a skipped Saturday or Sunday is moved by one day in the direction of its sign. Holidays between the initial and the resulting date are not skipped; working days are added by the “ADDWORKDAYS” function. By default, Saturdays and Sundays are skipped; to prevent both of these days from being skipped, the text “sat” and “sun” must be specified as the “sat” and “sun” parameters. For an invalid date it returns an empty string.

Example:

ADDDAYS(1.1.2000, -9.2, -2, sat, sun)
// Returns “22.12.1999 19:12”
ADDDAYS(1.1.2000, 0, 1, sat, sun)
// Returns “02.01.2000”
ADDDAYS(1.1.2000, 12, 0, sat, sun)
// Returns “13.01.2000”
ADDDAYS(#today#, 0, 3, sat, sun)
 

DateTime ADDHOURS(DateTime date, double hours)

Use: HTML, JavaScript, Script

Description: The function adds the number of hours defined by the “hours” parameter to the date specified by the “date” parameter. The “hours” parameter can also be negative (subtracting hours) or decimal (adding minutes). For an invalid date it returns an empty string.

Example:

ADDHOURS(1.1.2000, -1.5)
// Returns “31.12.1999 22:30”
ADDHOURS(1.1.2000, 0)
// Returns “01.01.2000”
ADDHOURS(1.1.2000, 5)
// Returns “01.01.2000 05:00”
ADDHOURS(#now#, 10)
 

DateTime ADDMINUTES(DateTime date, double minutes)

Use: HTML, JavaScript, Script

Description: The function adds the number of minutes defined by the “minutes” parameter to the date specified by the “date” parameter. The “minutes” parameter can also be negative (subtracting minutes) or a decimal number. For an invalid date it returns an empty string.

Example:

ADDMINUTES(1.1.2000, -2.5)
// Returns “31.12.1999 23:57:30”
ADDMINUTES(1.1.2000, 0)
// Returns “01.01.2000”
ADDMINUTES(1.1.2000, 2)
// Returns “01.01.2000 00:02”
ADDMINUTES(#now#, 0)
 

DateTime ADDMONTHS(DateTime date, int months)

Use: HTML, JavaScript, Script

Description: The function adds the number of months defined by the “months” parameter to the date specified by the “date” parameter. The “months” parameter can also be negative (subtracting months). Entering a decimal number in the “months” parameter causes a conversion to the “int” data type, it does not round, but the numbers after the decimal point are truncated. For an invalid date it returns an empty string.

Example:

ADDMONTHS(1.1.2000, -2.5)
// Returns “01.11.1999”
ADDMONTHS(1.1.2000, 0)
// Returns “01.01.2000”
ADDMONTHS(1.1.2000, 2)
// Returns “01.03.2000”
ADDMONTHS(#now#, -2)
 

DateTime ADDTIMESPANINWORDS(DateTime date, string expression1, string expression2, ...)

Use: HTML, JavaScript, Script

Description: The function adds to the date specified by the “date” parameter the time data expressed by the verbal description defined by the “expression1”, “expression2”, etc. parameter. The function can contain any number of parameters that is greater than or equal to 2. The verbal description of the time data can be written in Czech, English, German or French; an expression that the function does not recognize is skipped. The number is entered as a whole number – an expression with a decimal number has no effect, and a comma splits the expression (for example “1,5 hours” adds 5 hours); a negative number subtracts the time data. For an invalid date it returns an empty string.

Example:

ADDTIMESPANINWORDS(1.1.2000, 2 months)
// Returns “01.03.2000”
ADDTIMESPANINWORDS(1.1.2000, 1 year)
// Returns “01.01.2001”
ADDTIMESPANINWORDS(1.1.2000, 1 year, 2 months, 1 day)
// Returns “02.03.2001”
ADDTIMESPANINWORDS(1.1.2000, 1 den)
// Returns “02.01.2000”
ADDTIMESPANINWORDS(1.1.2000 12:05, 1 year, 2 months, 1 day, 5 minutes, 28 seconds)
// Returns “02.03.2001 12:10:28”
 

DateTime ADDWORKDAYS(DateTime date, int days)

Use: HTML, JavaScript, Script

Description: The function adds to the date specified in the “date” parameter the number of working days defined in the “days” parameter. The calculation takes weekends and public holidays recorded in the base “Settings” application into account; a day with a public holiday for only part of the day is treated as a non-working day as a whole. The “days” parameter may also be negative (subtracting working days). If a decimal value is provided in the “days” parameter, it is converted to the “int” data type without rounding (the decimal part is truncated). A value of “0” returns the original date without any change. For an invalid date it returns an empty string.

Example:

ADDWORKDAYS(1.1.2000, -2.5)
// Returns “30.12.1999”
ADDWORKDAYS(1.1.2000, 0)
// Returns “01.01.2000”
ADDWORKDAYS(1.1.2000, 2)
// Returns “04.01.2000”
ADDWORKDAYS(#now#, -2)
 

DateTime ADDWORKHOURS(DateTime date, double hours, int starthour, int endhour)

Use: HTML, JavaScript, Script

Description: The function adds to the date specified in the “date” parameter the number of working hours defined in the “hours” parameter. The “hours” parameter may also be negative (subtracting working hours) or a decimal value (adding minutes). The calculation takes into account the working hours defined by the “starthour” and “endhour” parameters, as well as weekends and public holidays recorded in the base “Settings” application. A day with a public holiday for only part of the day is treated as a non-working day as a whole. If the specified time falls outside working hours or on a non-working day, the function shifts it to the nearest following start of working hours when adding hours, and to the nearest preceding end of working hours when subtracting hours. The “starthour” parameter can take the values 0 to 23 and the “endhour” parameter the values 1 to 24; a value outside the range is replaced by 0 or 24 respectively. If “starthour” is not less than “endhour”, the function returns the specified date unchanged. With the value “0”, the function returns the specified date unchanged. For an invalid date it returns an empty string.

Example:

ADDWORKHOURS(1.1.2000 10:00, 4, 8, 16)
// Returns “03.01.2000 12:00”
ADDWORKHOURS(1.1.2000 10:00, -2, 8, 16)
// Returns “31.12.1999 14:00”
ADDWORKHOURS(1.1.2000 10:00, 0, 8, 16)
// Returns “01.01.2000 10:00”
ADDWORKHOURS(#now#, 8, 8, 16)
 

DateTime ADDYEARS(DateTime date, int years)

Use: HTML, JavaScript, Script

Description: The function adds the number of years defined by the “years” parameter to the date specified by the “date” parameter. The “years” parameter can also be negative (subtracting years). Entering a decimal number in the “years” parameter causes a conversion to the “int” data type, it does not round, but the numbers after the decimal point are truncated. For an invalid date it returns an empty string.

Example:

ADDYEARS(1.1.2000, -2.5)
// Returns “01.01.1998”
ADDYEARS(1.1.2000, 0)
// Returns “01.01.2000”
ADDYEARS(1.1.2000, 2)
// Returns “01.01.2002”
ADDYEARS(#today#, 2)
 

double ARCCOS(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the arc cosine of the value specified by the “number” parameter. The “number” parameter must be in the range from -1 to 1, otherwise the function returns “NaN”. The result is expressed in radians.

Example:

ARCCOS(0)
// Returns “1,5707963267949”
ARCCOS(2)
// Returns “NaN”
ARCCOS(#A#)
 

double ARCSIN(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the arc sine of the value specified by the “number” parameter. The “number” parameter must be in the range from -1 to 1, otherwise the function returns “NaN”. The result is expressed in radians.

Example:

ARCSIN(0)
// Returns “0”
ARCSIN(-1)
// Returns “-1,5707963267949”
ARCSIN(2)
// Returns “NaN”
ARCSIN(#A#)
 

double ARCTAN(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the arc tangent from the value specified by the “number” parameter. The result is expressed in radians and lies in the range from -pi/2 to pi/2.

Example:

ARCTAN(-0.5)
// Returns “-0,463647609000806”
ARCTAN(3)
// Returns “1,24904577239825”
ARCTAN(#A#)
 

string ATTACHMAILSIGNATURE(string body, string signature)

Use: HTML, JavaScript, Script

Description: The function inserts the e-mail signature defined by the “signature” parameter into the e-mail message specified by the “body” parameter. If the message contains a quotation of a previous message created by the “REPLYBODY” function, the function inserts the e-mail signature before the first such quotation; otherwise the e-mail signature is inserted at the end of the e-mail message. Quotations created by other e-mail clients are not recognized. If the message is empty, the function returns only the signature; if the signature is empty, it returns the message without a signature.

Example:

ATTACHMAILSIGNATURE(abc, Best regards)
 

int ATTACHMENT2PDF(int file)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function converts the file attachment specified by the “file” parameter to the “pdf” format. The function accepts the file attachment ID in “doc”, “docx”, “docm”, “xls”, “xlsx” or “xlsm” format, and returns the ID of the newly created file attachment in “pdf” format. If the file does not exist or has another format, the function returns “0”. Example:

ATTACHMENT2PDF(#ng_file#)
 

int ATTACHMENT2PDF(string file)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function converts the file attachment specified by the “file” parameter to the “pdf” format. The function accepts the full path of the file attachment in “doc”, “docx”, “docm”, “xls”, “xlsx” or “xlsm” format, and returns the ID of the newly created file attachment in “pdf” format. If the file does not exist or has another format, the function returns “0”. Depending on the environment of the instance, the file path may be restricted to allowed directories; an attempt to access a path outside them then throws an exception. Example:

ATTACHMENT2PDF(#rootpath#Temp\file.doc)
ATTACHMENT2PDF(#rootpath#Temp\file.xls)
 

string ATTACHMENTCONTENT(int file)

Use: HTML, JavaScript, Script

Description: The function returns the contents of the file attachment specified by the “file” parameter in the form of a text string. The file is read in UTF-8 encoding; if it does not exist, the function returns an empty string.

Example:

ATTACHMENTCONTENT(#ng_file#)
 

string ATTACHMENTDIMENSIONS(int image)

Use: HTML, JavaScript, Script

Description: The function returns the dimensions of the file attachment – image – specified by the “image” parameter in the format “width;height”. The values are in pixels. If the file attachment is not an image or the file does not exist, the function returns “0;0”.

Example:

ATTACHMENTDIMENSIONS(#ng_image#)
 

string ATTACHMENTGALLERY(string attachments, int maxwidth, int maxheight[, int perrow[, string zoom]])

Use: HTML

Description: The function displays thumbnails or links to file attachments in a list below each other. File attachments are specified by the “attachments” parameter as a semicolon-separated list of file attachment IDs. The “maxwidth” and “maxheight” parameters specify the maximum width and height of the thumbnail in pixels. Images (BMP, GIF, JPE, JPEG, JPG and PNG) are displayed as thumbnails; if both “maxwidth” and “maxheight” are 0, the image is displayed in its original size with the file name and without a link for opening it. PDF and TIFF (TIF) files are displayed as thumbnails of the individual pages (at most 1000 pixels wide if both parameters are 0), other files as a link. The optional “perrow” parameter specifies the number of images side by side in one row of the gallery; the value 0 or an omitted parameter displays the images below each other. The optional “zoom” parameter enables zooming and panning of the image directly in the thumbnail: the mouse wheel over the thumbnail zooms the image in and out, dragging with the mouse pans it, and double-clicking returns the thumbnail to its original size. With zooming enabled, the link to open the full-size image is displayed below the thumbnail as the file name. The value “zoom” is written in lower case, and zooming does not apply to images displayed in their original size (the “maxwidth” and “maxheight” parameters both with the value 0).

Example:

ATTACHMENTGALLERY(#ng_file1:value#;#ng_file2:value#;#ng_file3:value#, 120, 120)
// Displays a gallery of images or links with a maximum size of 120x120 pixels
ATTACHMENTGALLERY(#ng_file1:value#;#ng_file2:value#, 300, 300, 2, zoom)
// Displays two images side by side with zooming and panning by mouse wheel and dragging
 

string ATTACHMENTIMG(int file)

Use: HTML, JavaScript, Script

Description: The function returns the HTML code of the image with the attachment specified by the “file” parameter. The result is the HTML element “img” with a link to the file and the name of the attachment as the alternative text. For an empty or non-existent file attachment ID, the function returns an empty string.

Example:

ATTACHMENTIMG(#ng_file:value#)
// Returns “<img src="Download.aspx?hWiPNy0VInyQJbufLA1pTA==" alt="Name of the attachment with image.png">”
 

string ATTACHMENTNAME(int file, bool extension)

Use: HTML, JavaScript, Script

Description: The function returns the name of the file attachment specified by the “file” parameter. The optional “extension” parameter specifies whether the name is returned including the file extension. The default value of the “extension” parameter is “true”, so the function returns the file name including the extension. For an empty or non-existent file attachment ID, the function returns an empty string.

Example:

ATTACHMENTNAME(#ng_file#)
ATTACHMENTNAME(#ng_file#, true)
 

int ATTACHMENTPAGES(int file)

Use: HTML, JavaScript, Script

Description: The function returns the number of pages of the file attachment specified by the “file” parameter. For files in “pdf” format, the actual number of pages of the PDF document is returned. For files in “tif” or “tiff” format, the number of frames (pages) of the TIFF file is returned. For all other existing formats, the function returns the value “1”. If the file does not exist on disk or the “file” parameter equals “0”, the function returns the value “0”. If the PDF or TIFF file cannot be read, for example because it is damaged, the function returns the value “0”.

Example:

ATTACHMENTPAGES(#ng_document#)
// Returns “5” for a 5-page PDF
ATTACHMENTPAGES(#ng_scan#)
// Returns “3” for a multi-page TIFF with 3 frames
ATTACHMENTPAGES(#ng_image#)
// Returns “1” for a JPG file
ATTACHMENTPAGES(0)
// Returns “0” (non-existent attachment)
 

string ATTACHMENTSIGNATURES(int file)

Use: HTML, JavaScript, Script

Description: The function returns the number of signature fields in the PDF file specified by the “file” parameter, including signature fields that contain no signature; it does not verify the validity of the signatures. If the PDF file contains no signature field, the function returns an empty string. For files in a format other than “pdf”, the function returns an empty string. If the file does not exist on disk or the “file” parameter equals “0”, the function returns the value “0”. If the PDF file cannot be read, for example because it is damaged, the function returns the value “0”.

Example:

ATTACHMENTSIGNATURES(#ng_document#)
// Returns “2” for a PDF with 2 digital signatures
ATTACHMENTSIGNATURES(#ng_document#)
// Returns “” (empty string) for a PDF without signature fields and “0” for a non-existent file
ATTACHMENTSIGNATURES(#ng_image#)
// Returns “” (empty string) for a JPG file
 

string ATTACHMENTSIGNATURES(int file, bool verified)

Use: HTML, JavaScript, Script

Description: The function returns information about the digital signatures in the PDF file specified by the “file” parameter. The “verified” parameter determines whether the validity of the signatures is verified. With the value “true”, the function returns the result in the format “number of signatures/number of valid signatures” (e.g. “2/1”); if the PDF file contains no signature, it returns an empty string. With the value “false”, the function behaves like the variant without the “verified” parameter – it returns the number of signature fields including fields without a signature, does not verify the validity of the signatures and returns an empty string for a PDF file without signature fields. For files in a format other than “pdf”, the function returns an empty string. If the file does not exist on disk or the “file” parameter equals “0”, the function returns the value “0”. If the PDF file cannot be read, for example because it is damaged, the function returns the value “0”.

Example:

ATTACHMENTSIGNATURES(#ng_document#, true)
// Returns “2/1” for a PDF with 2 signatures, one of which is valid
ATTACHMENTSIGNATURES(#ng_document#, false)
// Returns the number of signature fields without verifying the validity of the signatures
 

long ATTACHMENTSIZE(int file)

Use: HTML, JavaScript, Script

Description: The function returns the size in bytes of the file attachment specified by the “file” parameter. If the file with the attachment does not exist on disk, the function returns the value “-1”.

Example:

ATTACHMENTSIZE(#ng_file#)
 

string ATTACHMENTURL(int file)

Use: HTML, JavaScript, Script

Description: The function returns the private Internet address of the file attachment specified by the “file” parameter, functional only for the currently logged in user, with a time validity limited to 24 hours. Outside the processing of a request for a page (for example in a script of a scheduled task), the address is created differently and generally works only for a public file attachment; a link that has to work elsewhere too, for example in an e-mail, is created by the variant with the “url” parameter. For an empty or non-existent file attachment ID, the function returns an empty string.

Example:

ATTACHMENTURL(1)
// Returns “Download.aspx?hWiPNy0VInyQJbufLA1pTA==”
ATTACHMENTURL(#ng_file#)
 

string ATTACHMENTURL(int file, string url)

Use: HTML, JavaScript, Script

Description: The function returns the public Internet address of the file attachment specified by the “file” parameter with unlimited validity. The “url” parameter specifies the base server address to which the generated file path is appended. At the same time, the function permanently marks the file attachment itself as public; this marking cannot be removed in NET Genium. In a test run of a script the function returns the address but does not mark the attachment as public. It behaves the same in the read-only mode of NET Genium Online and in demo mode; in demo mode it marks the attachment as public only if the “Demo.txt” configuration file lists the “sfiles” table and the function is not evaluated in a script to which demo mode applies (see chapter 1.6.). The address contains the file name, so it stops working after the file attachment is renamed. If the “url” parameter contains the address of a page (it contains “.aspx”), only the address of the directory in which the page is located is used; a slash at the end of the address is appended automatically. The address of the directory is derived from the address of a page only while a request for a page is being processed; elsewhere, for example in a scheduled task, the address of the directory has to be specified directly. For an empty or non-existent file attachment ID, the function returns an empty string.

Example:

ATTACHMENTURL(1, https://www.netgenium.com)
// Returns “https://www.netgenium.com/Download.aspx?hWiPNy0VInyQJbufLA1pTA==”
ATTACHMENTURL(#ng_file#, https://www.netgenium.com)
 

string ATTACHMENTVIDEO(int file, int maxwidth, int maxheight)

Use: HTML, JavaScript, Script

Description: The function returns the HTML code of the video for the file attachment specified by the “file” parameter. The “maxwidth” and “maxheight” parameters specify the maximum width and height of the video in pixels. Instead of a file attachment ID, the first parameter can also be a direct YouTube video URL (containing “youtube” or “youtu.be” in the URL). In that case the function generates the HTML embed code for the YouTube video at the given size. If the “maxwidth” or “maxheight” parameter is zero or not numeric, the function returns an empty string; it also returns an empty string for an attachment that does not exist and for a first parameter that is neither an attachment ID nor a YouTube address.

Example:

ATTACHMENTVIDEO(#ng_file:value#, 1000, 500)
// Returns “<video><source src="Download.aspx?hWiPNy0VInyQJbufLA1pTA=="></video>”
ATTACHMENTVIDEO(#ng_file:value#, 640, 360)
// Returns the video HTML code with a maximum size of 640x360 pixels
ATTACHMENTVIDEO(https://youtu.be/umHwS8ihloo, 640, 360)
// Returns the HTML embed code for a YouTube video at 640x360 pixels
ATTACHMENTVIDEO(0, 640, 360)
// Returns an empty string (non-existent attachment, zero ID)
 

double AVERAGE(object[] array)

Use: Script

Description: The function returns the average of the values of the script variable specified by the “array” parameter, if the variable is an array of values. If the variable is not an array of values, the function returns the value of the variable. The function takes text values – even those of a variable that is not an array of values – as time values in the “HH:mm” format and returns the average in minutes. The function skips empty elements of the array and calculates the average only from the non-empty elements. If the array does not contain any non-empty element, the function returns “0”. The function counts the values of a variable of the “Date” type as “0”, so it returns “0” for such a variable. The function returns a decimal number with a decimal point.

Example:

AVERAGE(#A#)
 

string BASE64DECODE(string base64)

Use: HTML, JavaScript, Script

Description: The function returns a decoded text string from a value encoded in Base64 format specified by the “base64” parameter. The result is decoded as text in UTF-8 encoding. If the input string is not valid Base64, the function does not throw an exception but returns an empty string.

Example:

BASE64DECODE(YWJj)
// Returns “abc”
BASE64DECODE(SGVsbG8gV29ybGQ=)
// Returns “Hello World”
BASE64DECODE(#ng_base64#)
// Returns the decoded text string from the “ng_base64” field
BASE64DECODE(!!!invalid_base64!!!)
// Returns “” (empty string – invalid Base64 does not throw an error)
 

string BASE64ENCODE(string value)

Use: HTML, JavaScript, Script

Description: The function returns an encoded string in the format “base64” from the text string specified by the “value” parameter.

Example:

BASE64ENCODE(abc)
// Returns “YWJj”
BASE64ENCODE(Hello World)
// Returns “SGVsbG8gV29ybGQ=”
BASE64ENCODE(#ng_text#)
// Returns the Base64 encoded text string from the “ng_text” field
 

string BUTTON(string title, string question, string button, string key)

Use: View table

Description: The function displays a user-defined button in the view table (DataGrid). The title of the button is defined by the “title” parameter. The “question” parameter specifies the question displayed in a confirmation dialog when the button is pressed; if the parameter is empty, the control button is invoked without confirmation. The button title and the question can be multilingual. The “button” parameter represents the name of the hidden control button, which must be on the same view page or edit form as the control with the displayed button. After pressing the displayed button and then confirming the question, pressing the control button is programmatically invoked, which starts the script on the server side. The “key” parameter defines the name of the auxiliary form element that will be automatically created when the button is clicked, and the ID of the processed record will be stored in its value. This ID can subsequently be found in the script of the control button using the server function “REQUESTFORM(key)”. To display the button, the “BUTTON” function call must be stored in the value of the “TextBox” control with the “String” data type, set to “Read-only” and as “Hidden field”; the button is not displayed in the “History” control. The value of the control must begin exactly with the text “BUTTON(” and end with a closing parenthesis. Besides the view table, the button is also rendered in other controls that display the value of such a control – for example in the text of events of the “Calendar”, “Planner” and “TimeTable” controls, in the title of a card of the “Kanban” control, in a node of the “Tree” control, in the additional displayed columns of the “ForeignKey” control and in the picker.

Example:

// Default value of the “TextBox” control:
BUTTON(Delete, Are you sure you want to delete the record?, DeleteItem, abc)
// “Assign value” command in the service button script:
A = “Integer(REQUESTFORM(abc))”
 

string CAPTCHA()

Use: HTML in the edit form

Description: The function inserts the captcha verification code into the HTML code of the edit form, which is used to distinguish real users from robots. The function is linked to the “EVALCAPTCHA” function, without which the “CAPTCHA” function would not make sense.

Note: This solution is obsolete and is not recommended for new implementations. The verification code is a short text rendered into an image, which today's automated tools read with a high success rate, and the protection has no solid basis in other respects either, so it is merely symbolic and practically does not protect the form against robots. The image also has no audio or other alternative, and is therefore inaccessible to visually impaired users. Public forms are protected by the “GOOGLECAPTCHA” and “EVALGOOGLECAPTCHA” functions.

Example:

CAPTCHA()
 

double CEILING(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the smallest integer that is greater than or equal to the value specified by the “number” parameter.

Example:

CEILING(-1.23)
// Returns “-1”
CEILING(1.23)
// Returns “2”
 

void CENTER

Use: Note of the edit form or HTML control name (the body of the control must be left blank)

Description: The function starts a block of controls that are displayed centered across the width of the edit form in user mode. Written in the note of the edit form, it centers the whole edit form.

Example:

// In the note of the edit form, the function is written with parentheses
CENTER()
// In the name of an HTML control, it is written without parentheses; “CENTER()” has no effect there
CENTER
 

void /CENTER

Use: HTML control name – The body of the control must be left blank

Description: The function ends a block of controls that are displayed centered across the width of the edit form in user mode.

Example:

/CENTER
 

string CHARS(string text)

Use: HTML, JavaScript, Script

Description: The function returns individual characters separated by a semicolon from the text string specified by the “text” parameter. The function outputs line break characters (CR and LF) as the text “\r” and “\n”.

Example:

CHARS(Administrator)
// Returns “A;d;m;i;n;i;s;t;r;a;t;o;r”
CHARS(Administrator#crlf#Anonymous)
// Returns “A;d;m;i;n;i;s;t;r;a;t;o;r;\r;\n;A;n;o;n;y;m;o;u;s”
 

string CHECKDISKSPACE(string drive, string min)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function checks whether the drive specified in the “drive” parameter has sufficient free space available. The required amount of free space is entered in the “min” parameter either as a percentage (e.g., “10%”), specifying the minimum proportion of free space relative to the drive’s total capacity, or as a decimal number (e.g., “10”), specifying the minimum amount of free space in gigabytes. If the required free space is available on the drive, the function returns “x”. Otherwise, it returns an empty string.

Example:

CHECKDISKSPACE(C, 10%)
// Returns “x” if drive C has at least 10% free space
CHECKDISKSPACE(C, 10)
// Returns “x” if drive C has at least 10 GB of free space
CHECKDISKSPACE(D, 20%)
// Returns “” if drive D has less than 20% free space
 

string CHECKMEMORYSPACE(string min)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function checks whether the operating memory (RAM) has sufficient free space available. The required amount of free memory is specified in the “min” parameter either as a percentage (e.g., “10%”), defining the minimum proportion of free memory relative to the total RAM capacity, or as a decimal number (e.g., “2”), defining the minimum amount of free memory in gigabytes. If the required amount of free memory is available, the function returns “x”. Otherwise, it returns an empty string.

Example:

CHECKMEMORYSPACE(10%)
// Returns “x” if RAM has at least 10% free space
CHECKMEMORYSPACE(2)
// Returns “x” if RAM has at least 2 GB of free space
 

void CLEARCACHE()

Use: Script (in a position where a comment is expected)

Description: The function clears the cache of the application model (among others application groups, applications, categories, view pages, edit forms, controls, database queries, scripts and their rights) in the process of the web application that executes the script; when more than one intranet address is filled in in the NET Genium settings, it also invalidates it in the other processes over the same database. Other caches, for example the NET Genium settings, are not cleared. When the script is run by the “RunScript.exe” program (scheduled task) or in a test run of the script, the function is not executed.

Example:

CLEARCACHE()
 

string COLORLEGEND()

Use: HTML, JavaScript, Script

Description: The function returns a bold legend heading – the word “LEGEND” translated according to the language setting of the currently logged-in user – as an HTML block, in the same way as the variant with the “text” parameter, only without the text in parentheses.

Example:

COLORLEGEND()
 

string COLORLEGEND(string text)

Use: HTML, JavaScript, Script

Description: The function returns a bold legend heading – the word “LEGEND” translated according to the language setting of the currently logged-in user, followed by the text specified by the “text” parameter in parentheses. The text is not translated and is output as specified; a multilingual text must therefore be translated by the TRANSLATE function. If the parameter is a database query, the function renders a colour legend based on the query result (see the following variant).

Example:

COLORLEGEND(Unpaid invoices)
// Returns e.g. “LEGEND (Unpaid invoices)”
COLORLEGEND(TRANSLATE(Neuhrazené faktury#en:Unpaid invoices))
// Returns “LEGENDA (Neuhrazené faktury)” for Czech or “LEGEND (Unpaid invoices)” for English
 

string COLORLEGEND(string query)

Use: HTML, JavaScript, Script

Description: If the parameter is a database query (SELECT), the function renders the bold heading “LEGEND” translated according to the language setting of the currently logged-in user and below it one legend row for each row of the query result. The first column of the result determines the colour of the rectangle (e.g. “#FF0000”), the values of the other columns are output after the rectangle separated by a hyphen.

  • Text values are translated according to the language of the logged-in user, date values are output in the date and time format of the user. For two consecutive values of the same day with a time, only the time is output for the second one.
  • The values are displayed as text; HTML tags in them are not rendered.
  • Empty values are omitted.
  • If the query returns fewer than two columns, only the heading is rendered. If the query ends with an error, the error text is output instead of the heading.
  • If the query does not pass the check of the query notation described for the “SQL” function, the parameter is processed as text (see the previous variant) and the function returns the legend heading with the text of the query in parentheses.
  • Variables and nested server function calls are evaluated in the query even if it is enclosed in double quotation marks.

Example:

COLORLEGEND("SELECT ng_color, ng_name FROM ng_status ORDER BY ng_order")
// Renders a legend with one row for each status – a rectangle in the colour from the “ng_color” field followed by the name of the status
 

string COLORLEGEND(string color, string text)

Use: HTML, JavaScript, Script

Description: The function returns a rectangle filled with the color specified by the “color” parameter in the HEX format “#ffffff” with a text label specified by the “text” parameter. This text can be multilingual.

Example:

COLORLEGEND(#44FF0A, Unpaid invoices#en:Unpaid)
 

string COLORLEGEND(int R, int G, int B, string text)

Use: HTML, JavaScript, Script

Description: The function returns a rectangle filled with the color specified by the RGB parameters in decimal with a text label specified by the “text” parameter. This text can be multilingual.

Example:

COLORLEGEND(255, 100, 100, Unpaid invoices#en:Unpaid)
 

string COLORLINK(string text, string url)

Use: HTML, JavaScript, Script

Description: The function returns a colored arrow and the text specified by the “text” parameter with a link specified by the “url” parameter. The text can be multilingual. If the link is clicked, the destination webpage will open in the current page frame. If the “url” parameter is exactly the address “default.aspx”, the page opens in the whole browser window; an address starting with “apps.aspx?” opens in the navigation area. The case of the address does not matter here.

Example:

COLORLINK(abc, ViewPage.aspx?viewpage=878)
// Opens the view page with ID 878 in the current page frame
COLORLINK(abc, Form.aspx?form=396)
// Opens the edit form with ID 396 in the current page frame
 

string COLORLINK(string text, string url, bool center)

Use: HTML, JavaScript, Script

Description: The function returns a colored arrow and the text specified by the “text” parameter with a link specified by the “url” parameter. The text can be multilingual. The “center” parameter says that the link placed in the portlets will be center-aligned. If the link is clicked, the destination webpage will open in the current page frame. If the “url” parameter is exactly the address “default.aspx”, the page opens in the whole browser window; an address starting with “apps.aspx?” opens in the navigation area. The case of the address does not matter here.

Example:

COLORLINK(abc, ViewPage.aspx?viewpage=878, true)
// Opens the view page with ID 878 in the current page frame
COLORLINK(abc, Form.aspx?form=396, true)
// Opens the edit form with ID 396 in the current page frame
 

string COLORLINK2(string text, string url)

Use: HTML, JavaScript, Script

Description: The function returns a colored arrow and the text specified by the “text” parameter with a link specified by the “url” parameter. The text can be multilingual. If the link is clicked, the destination webpage will open in a new window.

Example:

COLORLINK2(abc, ViewPage.aspx?viewpage=878)
// Opens the view page with ID 878 in a new window
COLORLINK2(abc, Form.aspx?form=396)
// Opens the edit form with ID 396 in a new window
 

string COLORLINK2(string text, string url, bool center)

Use: HTML, JavaScript, Script

Description: The function returns a colored arrow and the text specified by the “text” parameter with a link specified by the “url” parameter. The text can be multilingual. The “center” parameter says that the link placed in the portlets will be center-aligned. If the link is clicked, the destination webpage will open in a new window.

Example:

COLORLINK2(abc, ViewPage.aspx?viewpage=878, true)
// Opens the view page with ID 878 in a new window with center alignment
COLORLINK2(abc, Form.aspx?form=396, true)
// Opens the edit form with ID 396 in a new window with center alignment

void COLUMN(int columnWidth, int labelWidth, int defaultControlWidth)

Use: HTML control name – The body of the control must be left blank

Description: The function starts a block of controls that are placed in columns and use a reverse design – the controls do not have a frame, have a colored background, and display the color bar below the control when focused. The total column width is defined by the “columnWidth” parameter. The width of the column with the control name is defined by the “labelWidth” parameter. When the value of the “labelWidth” parameter is set to “0”, the column with the name of the control is not displayed, and the controls start from the left. The default size of the controls is defined by the “defaultControlWidth” parameter, and is important for the CheckBox and Radio controls, which are located in the reverse design in the same way as the other controls in the color box. Every further “COLUMN” call before the block is ended starts a new column to the right of the previous one; the paired “/COLUMN” function is therefore written only once, after the last column of the row, and ends the whole row of columns. In admin mode the columns are not created, and on a small screen they are displayed one below another.

Example:

COLUMN(500, 100, 150)
 

void /COLUMN

Use: HTML control name – The body of the control must be left blank

Description: The function ends the row of columns of controls with a reverse design that was started by one or more calls of the “COLUMN” function. It is paired with the “COLUMN” function and is written once, after the last column of the row.

Example:

/COLUMN
 

void COMMIT()

Use: Script (where a comment is expected)

Description: The function commits the currently executed transaction of the server script, and performs database operations of the following script commands, which are by default executed only after the successful execution of the entire script: save the variable back to the database, delete record, new record (the content of the variable “#nid#” is filled immediately after the “COMMIT” function is executed), save the value to the database and save multiple values to the database.

Example:

COMMIT()
// Commits the current transaction and performs all pending database operations
 

string COMPANYID(string company)

Use: HTML, JavaScript, Script

Description: The function returns the company name specified by the “company” parameter without the legal form at its end, converted to upper case, in which only letters and digits remain – spaces, hyphens, commas, periods and all other characters are removed. It recognizes the legal forms of companies from Czechia, Slovakia, Germany, Austria, Switzerland, Liechtenstein, Luxembourg, the United Kingdom, Ireland, the United States, Canada, Australia, New Zealand, Poland, France, Belgium, the Netherlands, Italy, Spain, Portugal, Sweden, Norway, Denmark, Finland, Estonia, Hungary, Romania, Slovenia, Croatia and Bulgaria (e.g. “s.r.o.”, “spol. s r.o.”, “a.s.”, “v.o.s.”, “GmbH”, “GmbH & Co. KG”, “Ltd”, “Inc”, “LLC”, “sp. z o.o.”, “SARL”, “B.V.”, “S.p.A.”, “Kft.”).

  • The legal form is removed only when it stands at the end of the name and is separated from the rest of the name by a space or a comma; it is not removed in the middle or at the beginning of the name, so “Jan K. Novák s.r.o.” returns “JANKNOVÁK”.
  • Spaces inside the abbreviation do not matter and its trailing period is optional.
  • An abbreviation containing a period is recognized regardless of letter case – “s. r. o.”, “S.R.O.” and “s.r.o” are recognized alike. An abbreviation without a period is recognized only in its usual spelling or entirely in upper case – “GmbH” and “GMBH”, but not “gmbh”.
  • Two-letter abbreviations without a period (“AG”, “AS”, “AB”, “SA”, “SE”, “KG” and the like) are not recognized at all, because they are often also the last word of a name that has no legal form – “Studio AD” returns “STUDIOAD” and “Beispiel AG” returns “BEISPIELAG”.
  • A name that ends differently or consists only of a legal form is processed as a whole.

Example:

COMPANYID(NetGenium s.r.o.)
// Returns “NETGENIUM”
COMPANYID(Example Holdings Ltd.)
// Returns “EXAMPLEHOLDINGS”
COMPANYID(Beispiel GmbH & Co. KG)
// Returns “BEISPIEL”
 

string COMPAREDATE(DateTime value1, string operator, DateTime value2, string yes, string no)

Use: HTML, JavaScript, Script

Description: The function returns the value of the “yes” parameter if the comparison of the value of the “value1” parameter with the value of the “value2” parameter is satisfied using the operator specified by the “operator” parameter. Otherwise, it returns the value of the “no” parameter. Supported operators are “=”, “<”, “<=”, “>” and “>=”. For any other operator the function returns an empty string.

Example:

COMPAREDATE(#today#, =, #now#, Yes, No) // Returns No
COMPAREDATE(#today#, <, #now#, Yes, No) // Returns Yes
COMPAREDATE(#today#, <=, #now#, Yes, No) // Returns Yes
COMPAREDATE(#today#, >, #now#, Yes, No) // Returns No
COMPAREDATE(#today#, >=, #now#, Yes, No) // Returns No
 

string COMPAREDOUBLE(double value1, string operator, double value2, string yes, string no)

Use: HTML, JavaScript, Script

Description: The function returns the value of the “yes” parameter if the comparison of the value of the “value1” parameter with the value of the “value2” parameter is satisfied using the operator specified by the “operator” parameter. Otherwise, it returns the value of the “no” parameter. Supported operators are “=”, “<”, “<=”, “>” and “>=”. For any other operator the function returns an empty string.

Example:

COMPAREDOUBLE(1, =, 2, Yes, No) // Returns No
COMPAREDOUBLE(1, <, 2, Yes, No) // Returns Yes
COMPAREDOUBLE(1, <=, 2, Yes, No) // Returns Yes
COMPAREDOUBLE(1, >, 2, Yes, No) // Returns No
COMPAREDOUBLE(1, >=, 2, Yes, No) // Returns No
 

string CONTACT(int id)

Use: HTML, JavaScript, Script

Description: The function returns the full name and e-mail address of the user specified by the “id” parameter. If the user has no full name filled in, the function returns only the e-mail address; if the user has no e-mail address filled in or does not exist, it returns an empty string.

Example:

CONTACT(1)
// Returns “"NetGenium s.r.o." <info@netgenium.com>”
CONTACT(#userid#)
 

string CONTACT(string loginname)

Use: HTML, JavaScript, Script

Description: The function returns the full name and e-mail address of the user specified by the “loginname” parameter. If the value of the parameter is a non-zero integer, the function looks the user up by ID, not by login name. If the user has no full name filled in, the function returns only the e-mail address; if the user has no e-mail address filled in or does not exist, it returns an empty string.

Example:

CONTACT(NetGenium)
// Returns “"NetGenium s.r.o." <info@netgenium.com>”
CONTACT(#loginname#)
 

string CONTACTEMAIL(string contact)

Use: HTML, JavaScript, Script

Description: The function returns the e-mail address of the contact specified by the “contact” parameter of the “e-mail address” type according to the RFC2822 specification.

Example:

CONTACTEMAIL("NetGenium s.r.o." <info@netgenium.com>)
// Returns “info@netgenium.com”
 

string CONTACTNAME(string contact)

Use: HTML, JavaScript, Script

Description: The function returns the name of the contact specified by the “contact” parameter of the “e-mail address” type according to the RFC2822 specification.

Example:

CONTACTNAME("NetGenium s.r.o." <info@netgenium.com>)
// Returns “NetGenium s.r.o.”
 

string CONTROL(string name, string html, string help)

Use: HTML in the edit form

Description: The function generates HTML code for a custom control in the edit form. The result is a control visually aligned with other form controls. The “name” parameter is displayed aligned in the column with control names, the “html” parameter contains the control itself or HTML content, the “help” parameter is aligned with the help texts of other controls. The “name” and “help” parameters can be multilingual; the “help” parameter is processed in the same way as the help of a database control. All three parameters are optional and can contain any text string, HTML code, variables, or function calls that are evaluated on the server side.

Example:

CONTROL(Name, <INPUT type=text class=tb>, Enter your name)
 

string CONTROL(string name, string html, int width, string help)

Use: HTML in the edit form

Description: The function generates HTML code for a custom control in the edit form in the same way as the variant with three parameters. In addition, it places the content of the “html” parameter into a block with the width specified by the “width” parameter in pixels; content that does not fit into the block is clipped.

Example:

CONTROL(Code, #ng_code:value#, 200, Code assigned by the system)
// Displays the value of the “ng_code” field in a block 200 pixels wide
 

void CONTROLINDETAILS()

Use: Note of a database control in the edit form

Description: The function entered in the “Notes” field on the “Help” tab of a database control allows its value to be changed directly in the record details – in the details panel of a view table, in the card text of the Kanban control and in the details of the Tree control. It applies only to controls that have the “Allow multiple assignments” check box selected on the “General” tab and under the same conditions as changing a value directly in a view table cell; without this function the details display only the value. DENYCONTROL() works the other way round: with it, a view table cell displays only the value without the option to change it.

Example:

CONTROLINDETAILS()
// The value of the control can be changed directly in the record details
 

string COPILOTCHAT(string secret)

Use: HTML in the edit form, HTML in the view page

Description: The function embeds a conversational chat built on Microsoft Copilot Studio (the Bot Framework Web Chat component) into the page. The “secret” parameter is the DirectLine secret (channel key) of the agent created in Copilot Studio. Based on it, the server starts a new conversation every time the page is rendered and returns the HTML and JavaScript that render the chat across the full width of the window, from the place where the function is inserted (but no higher than the bottom edge of the page toolbar) down to the bottom edge of the window; the chat covers the page content below that place. The browser downloads the chat component from cdn.botframework.com, and both the server and the browser communicate with the Microsoft Direct Line service (europe.directline.botframework.com) – both therefore need outgoing access to these addresses. The function does not require the license key to allow AI. The chat colors are automatically derived from the appearance of the page into which the function is inserted (the portal appearance, or the appearance set by the “LAYOUT” function). If the conversation cannot be started, the function returns a localized error message.

Example:

COPILOTCHAT(3xAbCdEf...)
// Embeds the Copilot Studio chat into the page based on the given DirectLine secret
 

int COPYATTACHMENT(int file)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a copy of the file attachment specified by the “file” parameter, and returns its ID. If the file attachment or its file does not exist, the function returns “0”.

Example:

COPYATTACHMENT(#ng_file#)
// Returns the ID of the newly created copy of the file attachment from the “ng_file” field
COPYATTACHMENT(123)
// Returns the ID of the newly created copy of the file attachment with ID 123
 

int COPYATTACHMENT(int file, string directory)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a copy of the file attachment specified by the “file” parameter and saves it to the directory specified by the “directory” parameter. The function returns the value “0” (it does not create a new attachment record in the database, it only copies the physical file). If the file attachment or its file does not exist, the function ends with an error. Depending on the environment of the instance, the target directory may be restricted to allowed directories; an attempt to write outside them then throws an exception. If the directory does not end with a backslash, one is appended automatically. The file is named in the directory after the ID of the file attachment and its extension (e.g. “123.pdf”), not after the name of the attachment; a file with the same name in the directory is overwritten.

Example:

COPYATTACHMENT(#ng_file#, C:\Directory)
// Copies the physical file of the attachment from the “ng_file” field to the directory “C:\Directory”, returns “0”
COPYATTACHMENT(123, C:\Backups)
// Copies the physical file of the attachment with ID 123 to the directory “C:\Backups”, returns “0”
 

double COS(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the cosine of the value specified by the “number” parameter. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

COS(-1.23)
// Returns “0,334237727124503”
COS(1)
// Returns “0,540302305868139”
COS(#A#)
 

int COUNT(object[] array)

Use: Script

Description: The function returns the number of values of the script variable specified by the “array” parameter, if the variable is an array of values, including empty elements of the array. If the variable is not an array of values, the function returns the value “1”.

Example:

COUNT(#A#)
 

string CRC16(string value1 [, string value2])

Use: HTML, JavaScript, Script

Description: The function returns “CRC16” the sum of all values specified in the function parameters. When determining the sum, the values are first separated by a hyphen.

Example:

CRC16(a, b, c)
// Returns “27651”
 

int CREATEATTACHMENT(string base64)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a file attachment from an image provided by the “base64” parameter. The function accepts an encoded string in Data URI format (“data:mime/type;base64,data”) and returns the ID of the newly created file attachment. The input string must start with the prefix “data:” and contain the separator “;base64,” – the file extension is automatically derived from the MIME type part, but only for images of the BMP, GIF, JPEG, PNG and TIFF types; for another type (for example “image/webp”) a file named “image” without an extension is created. If the input does not start with the prefix “data:” or does not contain the separator “;base64,”, the function returns “0”; invalid data after the separator throw an exception.

Example:

CREATEATTACHMENT(#ng_kod#)
// Returns the ID of the newly created file attachment from the value of the “ng_kod” field (must be in Data URI format)
CREATEATTACHMENT(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAEsCAYAAAA1u0HIAAAgAElEQVR4nOzd+1tSWRs38PePW7oVJVEUUQwhD5hKkhTlidIOFmlROqRFqWVZmuWkWZZmWWRalmWZlmVDWc4YZY8TM...)
// Returns the ID of the newly created file attachment named “image.png”
CREATEATTACHMENT(data:image/jpeg;base64,/9j/4AAQSkZJRgAB...)
// Returns the ID of the newly created file attachment named “image.jpg”
CREATEATTACHMENT(incorrect_format)
// Returns “0” – the input is not a valid Data URI
 

int CREATEATTACHMENT(string code, string type, int width, int height, bool label)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a file attachment from the barcode specified by the “code” parameter. The barcode type specified by the “type” parameter can take one of the following values:

  • “CODABAR”
  • “CODE128”
  • “CODE128A”
  • “CODE128B”
  • “CODE128C”
  • “CODE39”
  • “CODE39EXTENDED”
  • “CODE93”
  • “EAN13”
  • “EAN8”
  • “UPCA”
  • “UPCE”
  • “ITF14”
  • “QRCODE”

The width of the image is defined by the “width” parameter, height by the “height” parameter; both dimensions must be positive, otherwise the function returns “0”. For the “QRCODE” type only the size of one dot of the code is derived from the “width” parameter – in pixels it is the integer part of the “width” parameter divided by 45, and if it comes out less than 1 or greater than 100, 3 pixels are used –, so the resulting size of the image depends on the length of the content, and neither the height nor the “label” parameter is reflected in the image. The letter case of the “type” parameter does not matter; a type other than those listed returns “0”. The optional “label” parameter (default value “true”) specifies whether a barcode should be displayed in Latin at the bottom of the image. An error may occur during image generation due to a barcode type mismatch with its content. These are mainly illegal characters or the length of the barcode. In this case, there is no interruption, but the error is listed in the final image itself in red on a white background. Except for the “CODE128”, “CODE128B”, “CODE39EXTENDED” and “QRCODE” types, the content of the code is converted to upper case before the image is generated. If 12 digits are entered for the “EAN13” type, 7 digits for the “EAN8” type, 11 digits for the “UPCA” type, 6 digits (number system 0) or 11 digits for the “UPCE” type and 13 digits for the “ITF14” type, the check digit is calculated; an incorrect check digit entered for these types is replaced with the correct one. The function returns the file attachment number of the created image.

Details
  • An image of the “QRCODE” type has no margin (quiet zone) around the code; free space around the code has to be ensured when the image is inserted, for example in a print template. Barcodes of the other types except “ITF14” have no quiet zone either – the bars fill the width of the image and at most the remainder of the width that is not divided among the bars stays free.
  • If a code of the “QRCODE” type contains characters outside ASCII, it is written in UTF-8 encoding with a BOM, which some QR code readers reject; text consisting only of ASCII characters and the text of a QR payment (starting with “SPD*1.0*ACC:”) is written without a BOM.
  • For types other than “QRCODE”, both the width and the height of the image must be less than 3000 pixels; otherwise an image with an error message is created instead of the barcode.

Example:

CREATEATTACHMENT(abc, CODE128A, 200, 100, false)
// Returns the ID of the newly created file attachment with a CODE128A barcode without a label
CREATEATTACHMENT(#ng_kod#, QRCODE, 200, 200, false)
// Returns the ID of the newly created file attachment with a QR code from the “ng_kod” field
CREATEATTACHMENT(1234567890128, EAN13, 300, 150, true)
// Returns the ID of the newly created file attachment with an EAN13 barcode with a label
 

string CREATEATTACHMENTTEST(string base64)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function verifies the source data of the image specified by the “base64” parameter. The function accepts the string in Data URI format (“data:mime/type;base64,data”) specified by the “base64” parameter, and returns “OK” if the string has the correct form and the data after the “;base64,” separator are valid. Otherwise, the function throws an exception. The function is not executed in a test run of the script or in demo mode.

Example:

CREATEATTACHMENTTEST(#ng_kod#)
// Returns “OK” if the encoded string from the “ng_kod” field has the correct form
CREATEATTACHMENTTEST(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAEsCAYAAAA1u0HIAAAgAElEQVR4nOzd+1tSWRs38PePW7oVJVEUUQwhD5hKkhTlidIOFmlROqRFqWVZmuWkWZZmWWRalmWZlmVDWc4YZY8TM...)
// Returns “OK” if the specified Base64 string has the correct form
 

string CREATEATTACHMENTTEST(string code, string type, int width, int height, bool label)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function verifies the input parameters of the barcode specified by the “code” parameter. The barcode type specified by the “type” parameter can take one of the following values:

  • “CODABAR”
  • “CODE128”
  • “CODE128A”
  • “CODE128B”
  • “CODE128C”
  • “CODE39”
  • “CODE39EXTENDED”
  • “CODE93”
  • “EAN13”
  • “EAN8”
  • “UPCA”
  • “UPCE”
  • “ITF14”
  • “QRCODE”

The width of the image is defined by the “width” parameter, height by the “height” parameter; both dimensions must be positive. The optional “label” parameter (default value “true”) specifies whether a barcode should be printed in Latin at the bottom of the image. For the “QRCODE” type neither the height nor the “label” parameter is reflected in the image. The function returns the value “OK” if the input parameters have valid values. Otherwise, the function throws an exception. The function is not executed in a test run of the script or in demo mode.

Details

For types other than “QRCODE”, both the width and the height of the image must be less than 3000 pixels; otherwise the function throws an exception.

Example:

CREATEATTACHMENTTEST(abc, CODE128A, 200, 100, false)
// Returns “OK” if the input parameters of the CODE128A barcode are valid
CREATEATTACHMENTTEST(#ng_kod#, QRCODE, 200, 200, false)
// Returns “OK” if the input parameters of the QR code from the “ng_kod” field are valid
CREATEATTACHMENTTEST(1234567890128, EAN13, 300, 150, true)
// Returns “OK” if the input parameters of the EAN13 barcode are valid
 

int CREATEPDFATTACHMENT(string attachments, string filename)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a PDF file by merging multiple file attachments into a single file with the filename specified by the “filename” parameter. The file attachments are provided via the “attachments” parameter as a list of file attachment IDs separated by semicolons. The function accepts attachments in the following formats: “pdf”, “doc”, “docx”, “docm”, “xls”, “xlsx”, “xlsm” and image formats “bmp”, “gif”, “jpe”, “jpeg”, “jpg”, “png”. Attachments in another format and attachments whose file does not exist on disk are not included in the resulting file and no error is reported. The function returns the ID of the newly created file attachment in “pdf” format.

Example:

CREATEPDFATTACHMENT(1;2;3, abc.pdf)
// Returns the ID of the newly created PDF file merged from attachments with IDs 1, 2 and 3
CREATEPDFATTACHMENT(#ng_file1:value#;#ng_file2:value#, result.pdf)
// Returns the ID of the newly created PDF file merged from fields “ng_file1” and “ng_file2”
 

int CREATEPDFATTACHMENT(string attachments, string filename, string images)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a PDF file by merging multiple file attachments, with the option to overlay images on specific pages. The “images” parameter contains a list of groups of six semicolon-separated values in the format “imageId;pageIndex;x1%;y1%;x2%;y2%”, where:

  • “imageId” – ID of the image file attachment; the value 0 inserts no image and the group only determines the page for the digital signature
  • “pageIndex” – page number (0 = first page)
  • “x1%”, “y1%” – coordinates of the top-left corner of the image as a percentage of page width/height
  • “x2%”, “y2%” – coordinates of the bottom-right corner of the image as a percentage of page width/height

Each group must have exactly 6 values; groups are repeated for each inserted image. If the number of values of the “images” parameter is not divisible by six, no group applies – no image is inserted and the function with the “signature” parameter does not sign the document either. The coordinates can be specified with or without the “%” character (e.g. “70%” or “70”). Accepted input formats: pdf, bmp, gif, jpe, jpeg, jpg, png, doc, docx, docm, xls, xlsx, xlsm.

Example:

CREATEPDFATTACHMENT(1;2, result.pdf, 5;0;70%;80%;95%;95%)
// Merges attachments 1 and 2, inserts attachment 5 as an image in the bottom-right of the first page
CREATEPDFATTACHMENT(#ng_file:value#, signed.pdf, 0;0;0%;85%;30%;98%)
// Inserts no image, the group only determines the first page for the digital signature (imageId=0 = no image)
 

int CREATEPDFATTACHMENT(string attachments, string filename, string images, string signature)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a PDF file by merging multiple file attachments, with the option to overlay images and apply a digital signature using a certificate. The “attachments”, “filename” and “images” parameters are identical to the previous overload. The “signature” parameter specifies the certificate and can take one of three formats:

  • “CU:SERIALNUMBER” – certificate from the CurrentUser store by serial number (hex)
  • “LM:SERIALNUMBER” – certificate from the LocalMachine store by serial number (hex)
  • “path/cert.pfx:password” – PFX file with password; depending on the environment of the instance, the path to the file may be restricted to allowed directories, and an attempt to use a file outside them then throws an exception

The digital signature is placed on the page determined by the last entry of the “images” parameter whose page number exists in the document. The signature covers the whole area of the page except for a margin of 10 points; the coordinates from the entry do not apply to it. If the “images” parameter contains no such entry, the function finds neither the certificate in the store nor the PFX file, or the password after the name of the PFX file is empty, the document is not signed and no error is reported. A wrong password to the PFX file ends the script with an error.

Example:

CREATEPDFATTACHMENT(1;2, signed.pdf, 5;0;70%;80%;95%;95%, CU:1A2B3C4D5E6F)
// Merges attachments, inserts image, and signs with a certificate from the CurrentUser store
CREATEPDFATTACHMENT(#ng_file:value#, signed.pdf, 0;0;0%;85%;30%;98%, C:\cert\signature.pfx:password123)
// Signs using a PFX file, the signature is placed on the first page
CREATEPDFATTACHMENT(#ng_file:value#, signed.pdf, 0;0;0%;85%;30%;98%, LM:AABBCC112233)
// Signs with a certificate from the LocalMachine store
 

int CREATETEXTATTACHMENT(string text, string filename)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a file attachment with the text content specified by the “text” parameter and the filename specified by the “filename” parameter. The text is stored in UTF-8 encoding without BOM. The function returns the ID of the newly created file attachment. Unlike the “CREATETEXTFILE” function, it does not write the file to a specified path but creates a regular file attachment – a record in the attachment register and a file in the attachment directory. The function is not executed in a test run of the script.

Example:

CREATETEXTATTACHMENT(Hello World, hello.txt)
// Returns the ID of the newly created attachment with the content “Hello World” and the filename “hello.txt”
CREATETEXTATTACHMENT(#ng_obsah#, export.csv)
// Returns the ID of the newly created attachment with the content from the “ng_obsah” field and the filename “export.csv”
CREATETEXTATTACHMENT({"key": "value"}, data.json)
// Returns the ID of the newly created JSON attachment
 

void CREATETEXTFILE(string text, string path)

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a text file on disk specified by the “path” parameter and writes the text defined by the “text” parameter to it in UTF-8 encoding with BOM. The file must have the extension “txt” or “json” – any other extension will throw an exception. Depending on the environment of the instance, the file path may be restricted to allowed directories; an attempt to write outside them then throws an exception. An existing file will be overwritten. The target directory must exist, otherwise the function ends with an error.

Example:

CREATETEXTFILE(text, C:\Directory\file.txt)
// Creates the file “file.txt” in the directory “C:\Directory” with the content “text”
CREATETEXTFILE(#ng_obsah#, C:\Directory\file.txt)
// Creates the file “file.txt” in the directory “C:\Directory” with the content from the “ng_obsah” field
CREATETEXTFILE({"key": "value"}, #rootpath#Temp\export.json)
// Creates a JSON file in the application's Temp directory
CREATETEXTFILE(content, C:\Directory\file.csv)
// Throws an exception – the extension “csv” is not allowed (only “txt” and “json” are allowed)
 

int CREATEZIPATTACHMENT(string attachments, string filename)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function creates a ZIP archive from file attachments with the archive name specified by the “filename” parameter. The file attachments are provided via the “attachments” parameter as a list of file attachment IDs separated by semicolons. The function returns the ID of the newly created file attachment in “zip” format. If two attachments have the same file name, the next of them gets a sequence number after its name in the archive (for example “contract (2).pdf”); an attachment listed more than once is added to the archive only once.

Example:

CREATEZIPATTACHMENT(1;2;3, abc.zip)
// Returns the ID of the newly created ZIP archive from file attachments with IDs 1, 2 and 3
CREATEZIPATTACHMENT(#ng_file1:value#;#ng_file2:value#, archive.zip)
// Returns the ID of the newly created ZIP archive from the “ng_file1” and “ng_file2” fields
 

DateTime DATE(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date (without hours, minutes, etc.) from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

DATE(15.2.2013 12:34)
// Returns “15.02.2013”
DATE(1.1.2000 23:59)
// Returns “01.01.2000”
DATE(#now#)
// Returns today's date without the time part
 

long DATE2LONG(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date value specified by the “date” parameter converted to a numeric value of type “long”. If the “date” parameter is not a valid date, the function returns an empty string.

Example:

DATE2LONG(1.1.2000)
// Returns “630822816000000000”
 

DateTime[] DateArray(DateTime date1; DateTime date2; ...)

Use: Script

Description: The function declares a script variable of the value field type “DateTime” from individual values specified by the parameter “date1”, “date2”, etc. The function parameters are separated by a semicolon or a tab. The “DateArray” function call must be case sensitive in the function name.

Example:

DateArray(#now#;#today#)
 

string DATECONDITION(string ng_date, DateTime date1, DateTime date2)

Use: HTML, Script

Description: The function returns the SQL code of the condition that is used to compare whether the column named “ng_date” (the content of the column is the date) lies between the data specified “date1” and “date2”. If the “date1” parameter is not a valid date, the function returns the condition “0=1”, which no record satisfies. If the “date2” parameter is not a valid date, the date “date1” is used instead, and if “date1” contains a time, the date “date1” increased by one minute.

Example:

// To use in a script designer query condition:
[(ID)] [equal to] [OK#crlf#DATECONDITION(ng_date, #ng_from#, #ng_to#)]
[(ID)] [equal to] [OK#crlf#DATECONDITION(ng_date, #ng_from:history#, #ng_to:history#)]
// There must be no space before OK#crlf#

DATECONDITION(ng_date, 10.6.2013, 10.6.2013)
// Returns “(ng_date >= '2013-06-10' AND ng_date < '2013-06-11')”
DATECONDITION(ng_date, 10.6.2013, 10.6.2013 18:30)
// Returns “(ng_date >= '2013-06-10' AND ng_date < '2013-06-10 18:30')”
DATECONDITION(ng_date, 10.6.2013 15:00, 10.6.2013)
// Returns “(ng_date = '2013-06-10' OR (ng_date >= '2013-06-10 15:00' AND ng_date < '2013-06-11'))”
DATECONDITION(ng_date, 10.6.2013 15:00, 10.6.2013 18:30)
// Returns “(ng_date = '2013-06-10' OR (ng_date >= '2013-06-10 15:00' AND ng_date < '2013-06-10 18:30'))”
 

string DATECONDITION(string ng_from, string ng_to, DateTime date1, DateTime date2)

Use: HTML, Script

Description: The function returns the SQL code of the condition that is used to compare whether the date interval specified by the parameters (database columns) “ng_from” and “ng_to” overlaps with the interval specified by the parameters “date1” and “date2”. If the “date1” parameter is not a valid date, the function returns the condition “0=1”, which no record satisfies. If the “date2” parameter is not a valid date, the date “date1” is used instead, and if “date1” contains a time, the date “date1” increased by one minute.

Example:

DATECONDITION(ng_from, ng_to, 10.6.2013, 10.6.2013)
// Returns “((ng_from >= '2013-06-10' AND ng_from < '2013-06-11' AND ng_to IS NULL) OR (ng_from < '2013-06-11' AND ng_to >= '2013-06-10'))”
DATECONDITION(ng_from, ng_to, 10.6.2013, 10.6.2013 18:30)
// Returns “((ng_from >= '2013-06-10' AND ng_from < '2013-06-10 18:30' AND ng_to IS NULL) OR (ng_from < '2013-06-10 18:30' AND ng_to >= '2013-06-10'))”
DATECONDITION(ng_from, ng_to, 10.6.2013 15:00, 10.6.2013)
// Returns “(((ng_from = '2013-06-10' OR (ng_from >= '2013-06-10 15:00' AND ng_from < '2013-06-11')) AND ng_to IS NULL) OR (ng_from < '2013-06-11' AND (ng_to = '2013-06-10' OR ng_to >= '2013-06-10 15:00')))”
DATECONDITION(ng_from, ng_to, 10.6.2013 15:00, 10.6.2013 18:30)
// Returns “(((ng_from = '2013-06-10' OR (ng_from >= '2013-06-10 15:00' AND ng_from < '2013-06-10 18:30')) AND ng_to IS NULL) OR (ng_from < '2013-06-10 18:30' AND (ng_to = '2013-06-10' OR ng_to >= '2013-06-10 15:00')))”
 

string DATECONDITION2(string ng_from, string ng_to, DateTime date1, DateTime date2)

Use: HTML, Script

Description: The function returns the SQL code of the condition that is used to compare whether the date interval specified by the parameters (database columns) “ng_from” and “ng_to” overlaps with the interval specified by parameters “date1” and “date2”, including the interval before the date “ng_from”. The function finds use when comparing, for example, the validity of prices – the price is valid from and until a certain date, but the validity can also be defined only by date from (“ng_to” is NULL), so with an unlimited validity period (price is valid from a certain date until present). A date without time in the “date2” parameter covers the whole day. If the “date1” parameter is not a valid date, the function returns the condition “0=1”, which matches no record. If the “date2” parameter is not a valid date, the date “date1” is used instead, and if “date1” contains a time, the date “date1” increased by one minute. The notation of date literals depends on the database server.

Example:

DATECONDITION2(ng_from, ng_to, 10.6.2013, 10.6.2013)
// Returns “((ng_from < '2013-06-11' AND ng_to IS NULL) OR (ng_from < '2013-06-11' AND ng_to >= '2013-06-10'))”
DATECONDITION2(ng_from, ng_to, 10.6.2013 15:00, 10.6.2013)
// Returns “((ng_from < '2013-06-11' AND ng_to IS NULL) OR (ng_from < '2013-06-11' AND (ng_to = '2013-06-10' OR ng_to >= '2013-06-10 15:00')))”
DATECONDITION2(ng_from, ng_to, 10.6.2013, 10.6.2013 18:30)
// Returns “((ng_from < '2013-06-10 18:30' AND ng_to IS NULL) OR (ng_from < '2013-06-10 18:30' AND ng_to >= '2013-06-10'))”
DATECONDITION2(ng_from, ng_to, 10.6.2013 15:00, 10.6.2013 18:30)
// Returns “((ng_from < '2013-06-10 18:30' AND ng_to IS NULL) OR (ng_from < '2013-06-10 18:30' AND (ng_to = '2013-06-10' OR ng_to >= '2013-06-10 15:00')))”
 

int DAYOFWEEK(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the day of the week number from the date specified by the “date” parameter as an integer in the range 1–7, where 1 represents Monday and 7 represents Sunday. Note: Sunday is always 7, not 0 (as is the case in the .NET DayOfWeek enum). If the “date” parameter is not a valid date, the function returns an empty string.

Example:

DAYOFWEEK(15.2.2024)
// Returns “4” (Thursday)
DAYOFWEEK(17.2.2024)
// Returns “6” (Saturday)
DAYOFWEEK(18.2.2024)
// Returns “7” (Sunday – always 7, not 0)
DAYOFWEEK(#today#)
// Returns the day of the week number for the current day
 

int DAYOFYEAR(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the number of the day of the year from the date specified by the “date” parameter as an integer in the range 1–365, or 1–366 in a leap year. If the “date” parameter is not a valid date, the function returns an empty string.

Example:

DAYOFYEAR(15.2.2024)
// Returns “46”
DAYOFYEAR(#today#)
// Returns the number of the current day of the year
 

void DELETEDATA(string dbname, string condition)

Use: Script (where a comment is expected)

Description: The function permanently deletes data from the database table specified by the “dbname” parameter under the conditions specified by the “condition” parameter. This function does not use history writing, does not run the “OnBeforeDelete” and “OnAfterDelete” scripts of the edit form, does not add the deletion to the synchronization queue (so it is not transferred to synchronized instances), and is optimized for mass data deletion that would otherwise fail at the timeout if run directly on the database, for example using “Microsoft SQL Server Management Studio”.

The “dbname” parameter must be the database table of an edit form, or the ID of an edit form – the function looks the form up in the “stables” system table. The function cannot be used on system tables that belong to no edit form – for example on the “stables_stats”, “sviewpages_stats”, “squerybuilder_stats”, “sngef_stats” and “sngscript_stats” log tables; in that case the function deletes nothing and returns the “FORM ... NOT FOUND!” message. The contents of the log tables are deleted by the “SqlBackup.exe” program run with the “/deletelogs” parameter, see the Utilities guide.

The function deletes immediately, outside the script transaction – a later error of the script does not restore the deleted data. For users, user groups and rights groups (the “susers”, “susergroups” and “srightsgroups” tables) the function deletes their relations together with the records in the same way as the edit form, in one transaction with the deletion of the records; it deletes the relations only for the records that were actually deleted. For rights groups the function clears the “Rights group” field of the users who had the deleted group; unlike the deletion itself, this clearing is written to the change history of the users and added to the synchronization queue. Records protected by the “system” flag (for example the built-in user groups) are not deleted, just as in the edit form; in the “slayout” layout table the active layout is not deleted either. The function rejects an empty condition. It reports the result by a message displayed in a dialog box after the script is executed, without interrupting the script: “OK” after all records meeting the condition have been deleted, “NOT DELETED: n” if n records meeting the condition remain after the deletion (typically because of a foreign key blocking the deletion, or because they are records with the “system” flag or the active layout), “Empty condition!” for an empty condition, “FORM ... NOT FOUND!” when the form is not found and the error text when the deletion fails. The function is not executed in a test run of the script.

Example:

DELETEDATA(ng_form, id < 123)
DELETEDATA(ng_form, date > FORMATDATESQL(#today#))
 

void DELETEHISTORY()

Use: Script (where a comment is expected)

Description: The function deletes the history of all edit forms from the database

  • older than 6 months,
  • older than X months if X is specified in the edit form settings.

The function deletes immediately, outside the script transaction – a later error of the script does not restore the deleted history. After the deletion it displays the message “OK” in a dialog box after the script is executed. The function is not executed in a test run of the script.

Example:

DELETEHISTORY()
 

void DELETEHISTORY(string dbname)

Use: Script (where a comment is expected)

Description: The function deletes the history of the edit form specified by the “dbname” parameter (identifier or ID of the edit form) from the database

  • older than 6 months,
  • older than X months if X is specified in the edit form settings.

The function deletes immediately, outside the script transaction – a later error of the script does not restore the deleted history. After the deletion it displays the message “OK” in a dialog box after the script is executed; if the edit form is not found, it displays the message “FORM ... NOT FOUND!” instead. The function is not executed in a test run of the script.

Example:

DELETEHISTORY(susers)
 

void DELETEHISTORY(string dbname, string condition)

Use: Script (where a comment is expected)

Description: The function deletes from the database the history of the edit form specified by the “dbname” parameter (identifier or ID of the edit form) under the conditions specified by the “condition” parameter. The condition is evaluated against the history table, so it can use its columns, for example “changedid”, “date” or “deleted”; the number of months set in the edit form does not apply to it. This function is optimized for mass data deletion that would otherwise fail at the timeout if run directly on the database, for example using “Microsoft SQL Server Management Studio”.

The function deletes immediately, outside the script transaction – a later error of the script does not restore the deleted history. The function rejects an empty condition. It reports the result by a message displayed in a dialog box after the script is executed, without interrupting the script: “OK” after a successful deletion, “Empty condition!” for an empty condition, “FORM ... NOT FOUND!” when the form is not found and the error text when the deletion fails. The function is not executed in a test run of the script.

Example:

DELETEHISTORY(susers, changedid = #id#)
 

void DISABLEAUTOFILL()

Use: Note of the edit form

Description: The function disables the web browser from automatically filling out forms for TextBox controls.

Example:

DISABLEAUTOFILL()
// Disables automatic form autofill in the web browser
 

void DISABLEFORM()

Use: Script (where a comment is expected) in the “OnAfterOpen” event of the edit form

Description: The function disables all controls located in the edit form, including the “Save” and “Delete” buttons. The function has no effect in other scripts. Using the “DISABLEFORM” function has the same effect from the users' point of view as using the “controls_Disable” javascript function, but it is safer for “File” and “Image” controls. By default, these controls contain buttons for uploading file attachments from the client station to the server – the server function “DISABLEFORM” safely removes these buttons, while the javascript function “controls_Disable” only hides them.

Example:

DISABLEFORM()
// Disables all controls in the edit form including the “Save” and “Delete” buttons
 

void DISABLEPAGETOOLS()

Use: Note of the view page or edit form

Description: The function disables the floating icons on the view page or in the edit form that appear in the upper right corner.

Example:

DISABLEPAGETOOLS()
// Disables floating icons in the top right corner of the page or form
 

double DISTANCE(double lat1, double lon1, double lat2, double lon2)

Use: HTML, JavaScript, Script

Description: The function returns the distance in kilometers between two geographical places specified by the parameters “lat1”, “lon1”, “lat2” and “lon2”. The “lat1” and “lat2” parameters are latitudes, the “lon1” and “lon2” parameters longitudes in degrees. The distance is calculated over the surface of a sphere with the equatorial radius of the Earth and the result is not rounded.

Example:

DISTANCE(50.0723726721, 14.108998537, 50.0794492033, 14.4476009458)
// Returns “24.2031494449185”
DISTANCE(#ng_lat1#, #ng_lon1#, #ng_lat2#, #ng_lon2#)
// Returns the distance in kilometers between the coordinates from the “ng_lat1”, “ng_lon1”, “ng_lat2” and “ng_lon2” fields
 

void DIV(string id)

Use: HTML control name – The body of the control must be left blank

Description: The function generates an HTML tag “<div id="{id}">”, i.e. starts a new div. The tag ID is defined by the “id” parameter. The block must always be ended by the paired “/DIV” function.

Example:

DIV(D1)
 

void DIV(string id, bool visible)

Use: HTML control name – The body of the control must be left blank

Description: The function generates an HTML tag “<div id="{id}">”, i.e. starts a new div. The tag ID is defined by the “id” parameter, and its visibility is defined by the “visible” parameter. With the value “true” (regardless of letter case) no style is output; with any other value, for example “false”, “0” or “1”, the tag gets the style “display:none” in user mode, while in admin mode the block remains visible. The block must always be ended by the paired “/DIV” function.

Example:

DIV(D1, false)
// Generates "<div id="D1" style="display:none">" in user mode
DIV(D1, true)
// Generates "<div id="D1">"
 

void /DIV

Use: HTML control name – The body of the control must be left blank

Description: The function generates an HTML tag “</div>”, i.e. the end of the previous div generated by the “DIV” function. It is paired with the “DIV” function and must always be placed at the end of the block. The function can also be written with parentheses, for example “/DIV(D1)” – the content of the parentheses is not used –, and it is recognized even if the body of the control is not empty – the content of the body is then not output.

Example:

/DIV
 

double[] DoubleArray(double number1; double number2; ...)

Use: Script

Description: The function declares a script variable of the value field type “Double” from individual values specified by the parameter “number1”, “number2 ”, etc. The function parameters are separated by a semicolon or a tab. The “DoubleArray” function call must be case sensitive in the function name.

Example:

DoubleArray(1.1;2.2;3.3)
 

string DROPZONE(string html, int width, int height, string accept, string control1 [, string control2...])

Use: Edit form HTML

Description: The function renders a drag-and-drop area (drop zone) in an edit form for dragging and uploading files. It allows inserting multiple files at once in an edit form, or selecting and uploading multiple file attachments simultaneously — the user either drags files into the marked area with the mouse or picks them via the standard file dialog (multiple files can be selected at once). The “html” parameter specifies its content, “width” and “height” its dimensions in pixels, “accept” the accepted file type filter, and the remaining parameters are database names of file controls that receive uploaded files in sequence. The UPLOADBUTTON function serves the same purpose (uploading multiple files at once) but renders a button for selecting files instead of a drop area.

The “accept” parameter can contain file extensions (“.jpg,.jpeg,.png”), MIME types (“application/pdf”, “image/*”) or “*” for any file type. The value “camera” on its own offers taking a photo with the camera on a mobile device (accepts images); it cannot be combined with extensions. An empty “accept” parameter does not render the button for selecting files – files can then only be dragged into the area. An empty “html” parameter renders the area without a label.

Examples:

DROPZONE(Drop files here, 500, 160, application/pdf, ng_attachment1, ng_attachment2)
CONTROL(Upload from gallery, DROPZONE(Drop zone for one or more files, 150, 30, ".jpg,.jpeg,.png", ng_file1, ng_image1), )
CONTROL(Take photo, DROPZONE(Drop zone for one or more files, 150, 30, camera, ng_file1, ng_image1), )
CONTROL(Take photo, DROPZONE(Drop zone for one or more files, 150, 30, "image/*", ng_file1, ng_image1), )
CONTROL(Drag, DROPZONE(Drop zone for dragging files only, 150, 100, "", ng_file1, ng_image1), )
CONTROL(Take photo, DROPZONE(Drop zone, 150, 30, "*", ng_file1, ng_image1), )
CONTROL(Take photo, DROPZONE("", 150, 30, "*", ng_file1, ng_image1), )
 

string EMAIL(int id)

Use: HTML, JavaScript, Script

Description: The function returns the e-mail address of the user specified by the “id” parameter. In JavaScript, a name written in lower case with an empty parameter (“email()”) is not evaluated and is preserved for the browser.

Example:

EMAIL(1)
EMAIL(#userid#)
 

string EMAIL(string loginname)

Use: HTML, JavaScript, Script

Description: The function returns the e-mail address of the user specified by the “loginname” parameter. If the value of the parameter is a non-zero integer, the function looks the user up by ID, not by login name. In JavaScript, a name written in lower case with an empty parameter (“email()”) is not evaluated and is preserved for the browser.

Example:

EMAIL(Administrator)
EMAIL(#loginname#)
 

string EMAILS(int id1 [, int id2])

Use: HTML, JavaScript, Script

Description: The function returns a semicolon-separated list of user email addresses whose ID is specified in the function parameters “id1”, “id2”, and so on. Each parameter can also contain several values separated by a semicolon or a tab, and IDs can be combined with login names; each user is in the result at most once. The addresses are in the result in the order in which the database returns them, not in the order of the parameters, and a user without an e-mail address may leave an empty item in it.

Example:

EMAILS(1, 2, 3)
 

string EMAILS(string loginname1 [, string loginname2])

Use: HTML, JavaScript, Script

Description: The function returns a semicolon-separated list of user email addresses whose login name is specified in the function parameters “loginname1”, “loginname2”, and so on. Each parameter can also contain several values separated by a semicolon or a tab, and login names can be combined with IDs; each user is in the result at most once. The addresses are in the result in the order in which the database returns them, not in the order of the parameters, and a user without an e-mail address may leave an empty item in it. A value that is a non-zero integer is evaluated as a user ID, not as a login name.

Example:

EMAILS(loginname1, loginname2, loginname3)
 

string[] EmailArray(string email1; string email2; ...)

Use: Script

Description: The function declares a script variable of the field type of values “String” from individual values specified by parameters “email1”, “email2”, etc. The function parameters are separated by a semicolon or a comma; empty parameters are left out, and an address given with the contact name stays in the array element including the name (a name containing a comma or a semicolon must be enclosed in quotation marks, and a semicolon in it is replaced by a comma). The “EmailArray” function call must be case sensitive in the function name. The “EmailArray” function is used for the e-mail list because the contact specified in the e-mail address may contain a semicolon.

Example:

EmailArray("NetGenium; s.r.o." <info@netgenium.com>;"NetGenium; s.r.o." <info@netgenium.com>)
 

string EMAILLINK(string dbname, int id)

Use: HTML, JavaScript, Script

Description: The function returns an HTML reference to the database record specified by the “dbname” and “id” parameters. The “dbname” parameter specifies the identifier or ID of the edit form, the “id” parameter is the primary key of the database record. The function is used to insert a link to a record into the text of an email. The address of the link is based on the “Internet address” field in the NET Genium settings, and if it is not filled in, on the “Intranet address” field; if the field contains more addresses, the function returns one link for each of them and separates them by a line break (the “br” tag). The address can be modified by the “NETGenium.Url” external function. The function does not report an edit form that does not exist; if the form is specified by its identifier, it returns a link with a zero form ID.

Details

In NET Genium Online, where neither field is displayed, the address of the link is based on the address of the instance “https://identifier.netgenium.online”.

Example:

EMAILLINK(susers, 1)
 

string EQUALS(string compare1, string compare2, string yes, string no)

Use: HTML, JavaScript, Script

Description: The function returns the value of the “yes” parameter if the value of the “compare1” parameter is equal to the value of the “compare2” parameter. Otherwise, it returns the value of the “no” parameter. The values are compared as text, case-sensitively.

Example:

EQUALS(#loginname#, Administrator, 0, -1)
 

string EVAL(string expression)

Use: HTML, JavaScript, Script

Description: The function recursively evaluates server functions contained in the text string specified by the “expression” parameter and returns the resulting string. It is useful for processing field values that themselves contain server functions or expressions — without EVAL these expressions would be returned as plain text. The function name must be written in uppercase (“EVAL”); a lowercase name will not be evaluated. The function also evaluates server functions that a user wrote into the value of a field or into data loaded by a query. It is therefore not used over values that a regular user can change; it is intended for values managed by administrators.

Example:

EVAL(SQL("SELECT title FROM ng_company WHERE id = 1"))
// First evaluates the SQL, then optionally the query result as an expression
EVAL(#ng_formula#)
// Evaluates server functions contained in the value of field “ng_formula”
EVAL(ADDDAYS(#today#, 7))
// Returns the date 7 days from today
 

void EVALATTACHMENTSTATUS(int file, string status, string message)

Use: Script (where a comment is expected)

Description: The function determines whether the file attachment specified by the “file” parameter (attachment ID) is in the state defined by the “status” parameter. If so, the function invokes a script interrupt with the message defined in the “message” parameter. Further pairs of state and message can follow the “message” parameter; the first pair whose state the attachment is in applies. NET Genium does not set the state of an attachment itself – it is written only by a custom integration, for example an external function or a service connected to an antivirus system, into the “status” column of the “sfiles” system table of attachments. An attachment whose state nobody has written has an empty state, so only a pair with an empty state applies to it. If the “file” parameter is empty or “0” (the attachment field is not filled in), the function checks nothing and does not interrupt the script, not even with a pair with an empty state. A typical use is when scanning an attachment with an antivirus system; the states “0” and “1” in the example are values written by such an integration. The function is not executed in a test run of the script.

Example:

EVALATTACHMENTSTATUS(#ng_attachment#, 0, Antivirus scan of attached documents is currently in progress. Please resubmit the form in a few seconds)
EVALATTACHMENTSTATUS(#ng_attachment#, 1, A viral infection was found in the attached XYZ document. Delete this attachment or use another one)
 

void EVALCAPTCHA(string captcha, string message)

Use: Script (in a place where a comment is expected)

Description: The function tests whether the text entered by the “captcha” parameter corresponds to the displayed captcha verification code, which was displayed in the edit form using the “CAPTCHA” function. If the texts do not match, the function interrupts the script with the error message specified by the “message” parameter. The function is linked to the “CAPTCHA” function, without which the “EVALCAPTCHA” function would not make sense.

Note: This solution is obsolete and is not recommended for new implementations — together with the “CAPTCHA” function, where the reason is described in more detail. Public forms are protected by the “GOOGLECAPTCHA” and “EVALGOOGLECAPTCHA” functions.

Example:

EVALCAPTCHA(#ng_verificationcode#, Please type the verification code from the image.)
 

void EVALGOOGLECAPTCHA(string secretKey, string message, [string proxy])

Use: Script (in a place where a comment is expected)

Description: The function tests whether the control that was displayed in the edit form using the “GOOGLECAPTCHA” or “GOOGLECAPTCHAINVISIBLE” function is checked. The first parameter is the unique key “secretKey”, which can be obtained together with the key “siteKey” when registering the Google reCAPTCHA element with Google. If the control is not checked, the function interrupts the script with an error message specified by the “message” parameter. If the “message” parameter is empty, an unsuccessful verification is only written to the log and the script continues; in admin mode the script is interrupted by the error codes returned by the verification endpoint. The optional “proxy” parameter is the address of the proxy server through which the verification request is sent — it is stated for servers that access the internet through a proxy. The function is linked to the “GOOGLECAPTCHA” function, without which the “EVALGOOGLECAPTCHA” function would not make sense.

Note: The verification goes through the original (legacy) Google verification endpoint and only evaluates whether the check passed or not. The function does not work with the score returned by score keys — it supports only Challenge (v2) and Invisible (v2) keys, that is, the keys inserted into the form by the “GOOGLECAPTCHA” and “GOOGLECAPTCHAINVISIBLE” functions.

Note: Every unsuccessful attempt is written into the “Warnings” log in the “Logs” directory of the given NET Genium instance — including the reason, that is a missing response from the service, or the error returned by the verification endpoint. In the test mode of the script designer the verification is not performed. The implementation procedure is provided in the separate guide Google reCAPTCHA implementation.

Example:

EVALGOOGLECAPTCHA(d5f545g5ccd5f2c5df1, Please check the CAPTCHA box.)
 

double EXP(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the value of the Euler number raised to the power specified by the “number” parameter. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

EXP(1.23)
// Returns “3,42122953628967”
EXP(#A#)
 

string EXPORTIMAGES(string html)

Use: HTML, JavaScript, Script

Description: The function exports inline images from the HTML code specified by the “html” parameter, and replaces all addresses of file attachments in the form “Download.aspx?abc” (including links to files other than images) with the data of the files encoded with “base64”.

Example:

A = String
A = EXPORTIMAGES(#ng_html#)
 

string EXPORTIMAGES(string html, int maxWidth, int maxHeight)

Use: Script

Description: The function replaces addresses of file attachments in the HTML code specified by the “html” parameter with the data of the files encoded with “base64”, but only for images inserted by the “img” tag whose “src” attribute starts with the address of a file attachment in the form “Download.aspx?abc”; links to files other than images are left unchanged. An image that has both the “width” and “height” attributes filled in and whose dimensions exceed the value of the “maxWidth” or “maxHeight” parameter is reduced proportionally, even if it is not a file attachment; to an image of a file attachment without both attributes the function adds them with reduced dimensions if its actual size exceeds one of the limits. At least one of the “maxWidth” and “maxHeight” parameters must be a positive number; otherwise the function is evaluated as the variant with the “dir” and “url” parameters. The function is not executed in a test run of the script or in demo mode.

Example:

A = String
A = EXPORTIMAGES(#ng_html#, 20, 15)
 

string EXPORTIMAGES(string html, string dir, string url)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function exports inline images from the HTML code specified by the “html” parameter to the directory on the disk specified by the “dir” parameter (a non-existent directory is created) and returns the HTML code in which the image references are replaced by addresses under the URL specified by the “url” parameter. The function inserts addresses of file attachments outside the “src” attribute (for example links to files other than images) into the result as data encoded with “base64” and does not save them to the directory. Images will be named in the order in which they are used sequentially in the HTML code. The first image will be named eg “img01.jpg”, the second “img02.jpg” etc. The function derives the file extension only for images of the BMP, GIF, JPEG, PNG and TIFF types; an image of another type is saved without an extension. The “url” parameter is a publicly available URL from which to download these images. Depending on the environment of the instance, the directory may be restricted to allowed directories; an attempt to write outside them then throws an exception. The function is not executed in a test run of the script or in demo mode.

Example:

A = String(#guid#)
B = String
B = EXPORTIMAGES(#ng_html#, #rootpath#Temp\#A#, https://www.netgenium.com/temp/#A#)
 

int EXPORTDATATOXMLATTACHMENT(string filename, string query1 [, string query2, ...])

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function runs one or more SQL SELECT queries and saves the results as an XML file attachment with the name specified by the “filename” parameter. The XML file is saved as a DataSet with the root element “NG” and schema (WriteSchema). Each query creates a separate table in the DataSet. The function returns the ID of the newly created file attachment.

Example:

EXPORTDATATOXMLATTACHMENT(export.xml, "SELECT * FROM ng_customer")
// Returns the ID of an XML attachment with the query results
EXPORTDATATOXMLATTACHMENT(export.xml, "SELECT * FROM ng_customer", "SELECT * FROM ng_contact WHERE pid = #id#")
// Returns the ID of an XML attachment with two tables
 

int EXPORTFORMDATATOXMLATTACHMENT(string filename [, string query1, string query2, ...])

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function saves the current data of the open edit form as an XML file attachment with the name specified by the “filename” parameter. Optionally, additional SQL SELECT queries can be added as further tables in the DataSet. The function returns the ID of the newly created file attachment.

Example:

EXPORTFORMDATATOXMLATTACHMENT(data.xml)
// Returns the ID of an XML attachment with the current form data
EXPORTFORMDATATOXMLATTACHMENT(data.xml, "SELECT * FROM ng_item WHERE pid = #id#")
// Returns the ID of an XML attachment with the form data and query results
 

void EXPORTDATATOXMLFILE(string path, string query1 [, string query2, ...])

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function runs one or more SQL SELECT queries and saves the results to an XML file on disk at the path specified by the “path” parameter. The file must have the “xml” extension, otherwise the function throws an exception. Depending on the environment of the instance, the path may be restricted to allowed directories; an attempt to write outside them then throws an exception.

Example:

EXPORTDATATOXMLFILE(#rootpath#Temp\export.xml, "SELECT * FROM ng_customer")
// Saves the query result to the file export.xml
EXPORTDATATOXMLFILE(#rootpath#Temp\export.xml, "SELECT * FROM ng_customer", "SELECT * FROM ng_contact")
// Saves the results of two queries as two tables in XML
EXPORTDATATOXMLFILE(#rootpath#Temp\export.csv, "SELECT * FROM ng_customer")
// Throws an exception – only the .xml extension is allowed
 

void EXPORTFORMDATATOXMLFILE(string path [, string query1, string query2, ...])

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function saves the current data of the open edit form to an XML file on disk at the path specified by the “path” parameter. Optionally, additional SQL SELECT queries can be added as further tables. The file must have the “xml” extension. Depending on the environment of the instance, the path may be restricted to allowed directories; an attempt to write outside them then throws an exception.

Example:

EXPORTFORMDATATOXMLFILE(#rootpath#Temp\data.xml)
// Saves the current form data to the file data.xml
EXPORTFORMDATATOXMLFILE(#rootpath#Temp\data.xml, "SELECT * FROM ng_item WHERE pid = #id#")
// Saves the form data and query result as two tables in XML

Behaviour common to the EXPORTDATATOXMLATTACHMENT, EXPORTFORMDATATOXMLATTACHMENT, EXPORTDATATOXMLFILE and EXPORTFORMDATATOXMLFILE functions:

  • A query parameter that does not pass the check of the query notation described for the “SQL” function is skipped by the function. If a query ends with an error, the function skips it as well and the error is only written to the log; the resulting file then does not contain the table concerned.
  • The EXPORTDATATOXMLFILE and EXPORTFORMDATATOXMLFILE functions require a path containing a backslash in the “path” parameter, otherwise they throw an exception. They create a non-existent directory and overwrite an existing file.

object FIRST(object[] array)

Use: Script

Description: The function returns the first value of a script variable specified by the “array” parameter if the variable is an array of values. If the variable is not an array of values, then the function returns the value of the variable. If the value field does not contain any element, the function returns an empty string.

Example:

FIRST(#A#)
 

DateTime FIRSTDAYINMONTH(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the first day of the month from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

FIRSTDAYINMONTH(15.2.2013)
// Returns “01.02.2013”
FIRSTDAYINMONTH(#today#)
 

DateTime FIRSTDAYINQUARTAL(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the first day of the quarter from the date specified by the “date” parameter. For an invalid date it returns an empty string. The function is also available under the alternative name “FIRSTDAYINQUARTER”.

Example:

FIRSTDAYINQUARTAL(15.2.2013)
// Returns “01.01.2013”
FIRSTDAYINQUARTER(15.5.2013)
// Returns “01.04.2013” (alternative name)
FIRSTDAYINQUARTAL(#today#)
 

DateTime FIRSTDAYINWEEK(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the first day of the week (Monday regardless of the language of the user) from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

FIRSTDAYINWEEK(15.2.2013)
// Returns “11.02.2013”
FIRSTDAYINWEEK(#today#)
 

DateTime FIRSTDAYINYEAR(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the first day of the year from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

FIRSTDAYINYEAR(15.2.2013)
// Returns “01.01.2013”
FIRSTDAYINYEAR(#today#)
 

double FLOOR(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the highest integer that is less than or equal to the value specified by the “number” parameter. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

FLOOR(-1.23)
// Returns “-2”
FLOOR(1.23)
// Returns “1”
 

void FLUSHFILE(string path)

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function sends the file on disk specified by the “path” parameter to the browser as a download. The file name is automatically derived from the path. Depending on the environment of the instance, the path may be restricted to allowed directories; an attempt to access a path outside them then throws an exception. A file that does not exist throws an exception. The function is not executed outside the processing of a page request.

Example:

FLUSHFILE(#rootpath#Temp\report.pdf)
// Initiates the download of report.pdf in the user's browser
 

void FLUSHFILE(string path, string filename)

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function sends the file on disk specified by the “path” parameter to the browser as a download with a custom file name specified by the “filename” parameter. Depending on the environment of the instance, the path may be restricted to allowed directories; an attempt to access a path outside them then throws an exception. A file that does not exist throws an exception. The function is not executed outside the processing of a page request.

Example:

FLUSHFILE(#rootpath#Temp\abc123.tmp, Export result.pdf)
// Initiates the download with the name “Export result.pdf”
FLUSHFILE(#rootpath#Temp\#ng_guid#.xml, export_#today#.xml)
// Downloads a temporary file with a dynamic name
 

string FORMATCURRENCY(double number)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into text – with the thousands separator and the decimal separator according to the language of the currently logged in user (a comma and a decimal point in English, a space and a decimal comma in Czech), and rounded to two decimal places.

Example:

FORMATCURRENCY(1100)
// Returns “1,100.00”
FORMATCURRENCY(1100.5)
// Returns “1,100.50”
FORMATCURRENCY(1100.5412)
// Returns “1,100.54”
 

string FORMATCURRENCY(double number, string symbol)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into text – with the thousands separator and the decimal separator according to the language of the currently logged in user (a comma and a decimal point in English, a space and a decimal comma in Czech), rounded to two decimal places, and with a symbol specified by the “symbol” parameter. The position of the symbol also follows the language of the user – in English the symbol precedes the number, in Czech it follows the number.

Example:

FORMATCURRENCY(1100, Kč)
// Returns “Kč 1,100.00”
FORMATCURRENCY(1100.5, Kč)
// Returns “Kč 1,100.50”
FORMATCURRENCY(1100.5412, Kč)
// Returns “Kč 1,100.54”

If the “symbol” parameter begins with a decimal number format in curly brackets (for example “{0.00}Kč”), the function ignores it and uses only the text after the bracket.

string FORMATDATATABLE(string query)

Use: HTML, JavaScript, Script

Description: The function returns the result of a query specified by the “query” parameter formatted in a table. If the query ends with an error, the function returns the error text.

Example:

FORMATDATATABLE("SELECT * FROM susers ORDER BY id")
FORMATDATATABLE("SELECT * FROM susers WHERE loginname = FORMATSTRINGSQL(#loginname#) ORDER BY id")
 

string FORMATDATATABLE(string query, string title)

Use: HTML, JavaScript, Script

Description: The function returns the result of a query specified by the “query” parameter formatted in a table, and with a title specified by the “title” parameter. If the title has the form “|title|text”, the title is displayed without the vertical bars in user mode, and when the query result is empty, the function returns the text after the second vertical bar instead of the table (an empty string for the form “|title|”). If the query ends with an error, the function returns the error text.

Example:

FORMATDATATABLE("SELECT * FROM susers ORDER BY id", Users)
FORMATDATATABLE("SELECT * FROM susers WHERE loginname = FORMATSTRINGSQL(#loginname#) ORDER BY id", Current user)
 

string FORMATDATATABLE(string query, string title, string width)

Use: HTML, JavaScript, Script

Description: The function returns the result of a query specified by the “query” parameter formatted in a table with a title specified by the “title” parameter in the same way as the variant with two parameters. The “width” parameter specifies the width of the table in pixels (e.g. “600”) or as a percentage (e.g. “100%”).

Example:

FORMATDATATABLE("SELECT * FROM susers ORDER BY id", Users, 100%)
 

string FORMATDATAVIEW(string query)

Use: HTML, JavaScript, Script

Description: The function returns the result of a query specified by the “query” parameter formatted in a table. If the query ends with an error, the function returns the error text.

Example:

FORMATDATAVIEW("SELECT * FROM susers ORDER BY id")
FORMATDATAVIEW("SELECT * FROM susers WHERE loginname = FORMATSTRINGSQL(#loginname#) ORDER BY id")
 

string FORMATDATAVIEW(string query, string title)

Use: HTML, JavaScript, Script

Description: The function returns the result of a query specified by the “query” parameter formatted in a table, and with a title specified by the “title” parameter. If the title has the form “|title|text”, the title is displayed without the vertical bars in user mode, and when the query result is empty, the function returns the text after the second vertical bar instead of the table (an empty string for the form “|title|”). If the query ends with an error, the function returns the error text.

Example:

FORMATDATAVIEW("SELECT * FROM susers ORDER BY id", Users)
FORMATDATAVIEW("SELECT * FROM susers WHERE loginname = FORMATSTRINGSQL(#loginname#) ORDER BY id", Current user)
 

string FORMATDATAVIEW(string query, string title, string width)

Use: HTML, JavaScript, Script

Description: The function returns the result of a query specified by the “query” parameter formatted in a table with a title specified by the “title” parameter in the same way as the variant with two parameters. The “width” parameter specifies the width of the table in pixels (e.g. “600”) or as a percentage (e.g. “100%”).

Example:

FORMATDATAVIEW("SELECT * FROM susers ORDER BY id", Users, 100%)
 

string FORMATDATE(DateTime date)

Use: HTML, JavaScript, Script

Description: The function formats the date specified by the “date” parameter into text based on the default template “D” and the language setting of the currently logged in user. For an invalid date it returns an empty string.

Example:

FORMATDATE(#today#)
// Returns for example “Tuesday, April 2, 2019”
 

string FORMATDATE(DateTime date, string template)

Use: HTML, JavaScript, Script

Description: The function formats the date specified by the “date” parameter into text based on the template defined by the “template” parameter and the language setting of the currently logged in user. For English, the culture is American English (en-US): the long date starts with the name of the day, month names precede the day, and the time is always displayed in the 24-hour format. The order of the day and month in the short date is taken from the date format of the instance (dd/mm/yyyy or mm/dd/yyyy) set in the NET Genium settings, not from the language; the separator of day, month and year follows the user's language. For an invalid date it returns an empty string. Templates include (examples for an English user of an instance with the dd/mm/yyyy date format):

  • “d”: 29/02/2000
  • “D”: Tuesday, February 29, 2000
  • “f”: Tuesday, February 29, 2000 12:34
  • “F”: Tuesday, February 29, 2000 12:34:00
  • “g”: 29/02/2000 12:34
  • “G”: 29/02/2000 12:34:00
  • “r”: Tue, 29 Feb 2000 12:34:00 GMT
  • “s”: 2000-02-29T12:34:00
  • “t”: 12:34
  • “T”: 12:34:00
  • “y”: February 2000
  • “dddd, MMMM dd yyyy”: Tuesday, February 29 2000
  • “dd-MM-yy”: 29-02-00
  • “w”: 9
  • “ww”: 09
  • “www”: 2000 / 09

Example:

FORMATDATE(#today#, dd.MM.yyyy)
FORMATDATE(#today#, s)
 

string FORMATDATES(string value, bool dayPrefix, bool weekNumber)

Use: HTML, JavaScript, Script

Description: The function replaces all occurrences of dates in the text string specified by the “value” parameter with the date in the date format of the currently logged in user (e.g. “14/11/2014” for an English user of an instance with the dd/mm/yyyy date format). Only dates written as two numbers and a four-digit year, separated by dots or slashes, are recognized; the order of the day and the month follows the date format of the logged-in user. The “dayPrefix” parameter indicates whether an abbreviated name of the day is inserted before each date. The “weekNumber” parameter indicates whether a week number is inserted after each date. If both parameters have the value “false”, the function returns the text unchanged.

Example:

FORMATDATES(abc #today# def, true, true)
// Returns “abc Fri 14/11/2014 (46th week) def”
FORMATDATES(abc #today# def, true, false)
// Returns “abc Fri 14/11/2014 def”
FORMATDATES(abc #today# def, false, true)
// Returns “abc 14/11/2014 (46th week) def”
 

string FORMATDATESQL(DateTime date)

Use: HTML, JavaScript, Script

Description: The function formats the date specified by the “date” parameter into a text form intended for use in a database query condition, for example in conjunction with the “SQL” function, and based on the habits of the current database. If the “date” parameter is not a valid date, the function returns the date 1/1/1800.

Example:

FORMATDATESQL(#today#)
SQL("SELECT name FROM sholiday WHERE date_ = FORMATDATESQL(1.1.2019)")
 

string FORMATDIFFERENCES(string compare1, string compare2)

Use: HTML, JavaScript, Script

Description: The function returns a table with two columns, where in the first column the values separated by a semicolon from the parameter “compare1” are displayed on individual rows, and in the second column the values from the parameter “compare2” are displayed in the same way. The values of both parameters are compared as two lists of rows: identical rows are displayed side by side unchanged, in a changed row only the changed words are highlighted in red, and an inserted or omitted value is displayed in red against an empty cell. Both a semicolon and a line break separate the values. The values are displayed as text; HTML tags in them are not rendered. The first column is named “A”, the second “B”.

Example:

FORMATDIFFERENCES(Text1;Secondtext2, Text1;Text2)
 

string FORMATDIFFERENCES(string compare1, string compare2, string header1, string header2)

Use: HTML, JavaScript, Script

Description: The function returns a table with two columns, where in the first column the values separated by a semicolon from the parameter “compare1” are displayed on individual rows, and in the second column the values from the parameter “compare2” are displayed in the same way. The values of both parameters are compared as two lists of rows: identical rows are displayed side by side unchanged, in a changed row only the changed words are highlighted in red, and an inserted or omitted value is displayed in red against an empty cell. Both a semicolon and a line break separate the values. The values are displayed as text; HTML tags in them are not rendered. The first column has a name defined by the “header1” parameter, the second by the “header2” parameter. If both names are the same, “(1)” and “(2)” are appended to them.

Example:

FORMATDIFFERENCES(Text1;Secondtext2, Text1;Text2, First, Second)
 

string FORMATDIFFERENCES(string compare1, string compare2, string header1, string header2, string title)

Use: HTML, JavaScript, Script

Description: The function returns a table with two columns, where in the first column the values separated by a semicolon from the parameter “compare1” are displayed on individual rows, and in the second column the values from the parameter “compare2” are displayed in the same way. The values of both parameters are compared as two lists of rows: identical rows are displayed side by side unchanged, in a changed row only the changed words are highlighted in red, and an inserted or omitted value is displayed in red against an empty cell. Both a semicolon and a line break separate the values. The values are displayed as text; HTML tags in them are not rendered. The first column has a name defined by the “header1” parameter, the second by the “header2” parameter; if both names are the same, “(1)” and “(2)” are appended to them. The entire table has a title defined by the “title” parameter.

Example:

FORMATDIFFERENCES(Text1;Secondtext2, Text1;Text2, First, Second, Differences)
 

string FORMATDOUBLE(double number)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into text – with the thousands separator and the decimal separator according to the language of the currently logged in user (a comma and a decimal point in English, a space and a decimal comma in Czech).

Example:

FORMATDOUBLE(1100)
// Returns “1,100”
FORMATDOUBLE(1100.5)
// Returns “1,100.5”
FORMATDOUBLE(1100.5412)
// Returns “1,100.5412”
 

string FORMATDOUBLE(double number, string symbol)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into text – with the thousands separator and the decimal separator according to the language of the currently logged in user (a comma and a decimal point in English, a space and a decimal comma in Czech), and with a symbol specified by the “symbol” parameter.

Example:

FORMATDOUBLE(1100, kg)
// Returns “1,100 kg”
FORMATDOUBLE(1100.5, kg)
// Returns “1,100.5 kg”
FORMATDOUBLE(1100.5412, kg)
// Returns “1,100.5412 kg”

If the “symbol” parameter begins with a decimal number format in curly brackets (for example “{0.00}kg”), the function rounds and formats the number according to this format and appends only the text after the bracket to the number. In that case no thousands separator is inserted, and the decimal separator is a point or a comma depending on which of these characters the format contains; if it contains both or neither, the decimal separator according to the language of the user is used.

FORMATDOUBLE(1100.5412, {0.00}kg)
// Returns “1100.54 kg”
FORMATDOUBLE(1100.5412, "{0,00}kg")
// Returns “1100,54 kg”
 

string FORMATDOUBLESQL(double number)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into a text form intended for use in a database query condition, for example in conjunction with the “SQL” function, and based on the habits of the current database.

Example:

SQL("SELECT COUNT(*) FROM sstatistics2 WHERE session > FORMATDOUBLESQL(1000.1234)")
 

string FORMATINTARRAYSQL(string array)

Use: HTML, JavaScript, Script

Description: The function formats the semicolon-separated list of non-zero numbers specified by the “array” parameter into a text format intended for use in a database query condition, for example in conjunction with the “SQL” function, and based on current database conventions. If the list of numbers does not contain any non-zero numeric value, the value “0” is returned.

Example:

SQL("SELECT loginname FROM susers WHERE id IN (FORMATINTARRAYSQL(1;2))")
 

string FORMATINTSQL(int number)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into a text form intended for use in a database query condition, for example in conjunction with the “SQL” function, and based on the habits of the current database. A value that is not a whole number – including a number with a decimal part and a number outside the range of the data type – is converted to “0”.

Example:

SQL("SELECT loginname FROM susers WHERE id = FORMATINTSQL(1)")
 

string FORMATLONGARRAYSQL(string array)

Use: HTML, JavaScript, Script

Description: The function formats the semicolon-separated list of nonzero large numbers specified by the “array” parameter into a text format intended for use in a database query condition, for example, in conjunction with the “SQL” function, and based on current database conventions. If the list of numbers does not contain any non-zero numeric value, the value “0” is returned.

Example:

SQL("SELECT loginname FROM susers WHERE id IN (FORMATLONGARRAYSQL(1;2))")
 

string FORMATLONGSQL(long number)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into a text form intended for use in a database query condition, for example in conjunction with the “SQL” function, and based on the habits of the current database. A value that is not a whole number – including a number with a decimal part and a number outside the range of the data type – is converted to “0”.

Example:

SQL("SELECT loginname FROM susers WHERE id = FORMATLONGSQL(1)")
 

string FORMATNUMBERINWORDS(double number)

Use: HTML, JavaScript, Script

Description: The function formats the number specified by the “number” parameter into words in the language of the currently logged-in user. The number is rounded to an integer; a value exactly halfway is rounded to the nearest even number (banker's rounding – 2.5 to 2, 3.5 to 4). The sign is not written out – a negative number is written in the same way as a positive one.

Example:

FORMATNUMBERINWORDS(123456)
// Returns “one hundred and twenty three thousand four hundred and fifty six”
FORMATNUMBERINWORDS(123456.5)
// Returns “one hundred and twenty three thousand four hundred and fifty six”
 

string FORMATSTRING(string template [, string variable0, ...])

Use: HTML, JavaScript, Script

Description: The function formats the text specified by the “template” parameter according to compound formatting conventions in C#. Variables whose occurrence will be replaced by variable values are declared in braces and are numbered from zero. The values are substituted into the template as text, so format strings for numbers and dates (for example “{0:N2}”) have no effect; numbers and dates are formatted by the “FORMATDOUBLE” and “FORMATDATE” functions. If the template contains an error (for example a reference to a value that is not specified), the function returns the template unchanged.

Example:

FORMATSTRING({0} + {1} = {2}, 1, 2, 3)
// Returns “1 + 2 = 3”
 

string FORMATSTRINGSQL(string text)

Use: HTML, JavaScript, Script

Description: The function formats the text string specified by the “text” parameter into a text form intended for use in a database query condition, for example in conjunction with the “SQL” function, and based on current database conventions – starting with the character “N” in the case of the MSSQL database, enclosed in apostrophes, and with apostrophes occurring inside the text escaped by doubling them.

Example:

SQL("SELECT id FROM susers WHERE loginname = FORMATSTRINGSQL(Administrator)")
 

string FORMATTABLE(string column1, string values1 [, string column2, string values2, ...])

Use: HTML, Script

Description: The function returns the HTML code of a table formatted in a universal appearance intended for e-mail messages, for example. The “column1” parameter defines the name of the first column of the table, the “values1” parameter defines the semicolon-separated values specified for this table column. The number of columns in the table is not limited, it is only necessary to specify other parameters of the function in pairs – the column name together with the values in this column. A semicolon is used as a value separator, so individual values in a column cannot contain a semicolon as a substring. The column names and the values may be multilingual (in the form “text#en:translation”) and are displayed in the language of the currently logged in user. The number of rows of the table is determined by the number of values in the first column; surplus values of the other columns are not displayed and missing values stay empty.

Example:

FORMATTABLE(A, 1;2;3, B, 4;5;6)
FORMATTABLE(A, #A#, B, #B#)
 
AB
1 4
2 5
3 6

string FORMATTIME(int minutes)

Use: HTML, JavaScript, Script

Description: The function formats the number of minutes specified by the “minutes” parameter into text in the format “HH:mm”. The number of hours does not wrap after 24 hours (1500 minutes returns “25:00”). A value that is not a whole number – including a number with a decimal part and a number outside the range of the data type – is converted to 0 and the function returns “00:00”.

Example:

FORMATTIME(1156)
// Returns “19:16”
FORMATTIME(-150)
// Returns “-02:30”
 

string FORMATTIME2(double seconds)

Use: HTML, JavaScript, Script

Description: The function formats the number of seconds specified by the “seconds” parameter into a text format in the format “HH:mm:ss”. The number of hours does not wrap after 24 hours, and the function appends the fractional part of the seconds after a point, at most three digits (FORMATTIME2(1156.5) returns “00:19:16.5”).

Example:

FORMATTIME2(1156)
// Returns “00:19:16”
FORMATTIME2(-150)
// Returns “-00:02:30”
 

string FORMNAME(int form)

Use: HTML, JavaScript, Script

Description: The function returns the full name of the edit form specified by the “form” parameter, including the name of the application group and application; the string “ / ” is used as a separator between these three names.

Example:

FORMNAME(#form#)
 

string FORMNAME(int form, string separator)

Use: HTML, JavaScript, Script

Description: The function returns the full name of the edit form specified by the “form” parameter, including the name of the application group and application. The text string specified by the “separator” parameter is used as a separator between these three names.

Example:

FORMNAME(#form#, " | ")
 

void FULLAJAXMODE()

Use: Note of the edit form, Note of the view page

Description: The function switches the page into a mode in which ajax requests are used instead of submitting the form. Saving, deleting and clicking a button then do not redraw the whole page, so the scroll position and the state of the window are preserved. The ajax response carries the whole document, from which the client replaces the content of the “body” tag and calls the “body_onload()” function again.

This brings requirements on the custom JavaScript. When they are not met, the page will not behave correctly:

  • The code of the “JavaScript” control is split into function declarations, which are placed in the header of the page and run once, and the remaining statements, which run when the page is loaded and again after every ajax request. These statements therefore have to be repeatable — attaching an event handler, inserting a new node into the page or incrementing a variable is otherwise done again with every request. A flag prevents the repeated execution, for example “if (!window.myControl) { window.myControl = true; ... }”.
  • The “let”, “const” and “class” declarations at the top level end with an error on the second run, because they declare the same name again. “var” has to be used instead, or the value assigned into the “window” object.
  • A “script” tag inside the content of the “HTML” and “RichText” controls does not run after an ajax request, because the content is inserted through the “innerHTML” property. The code therefore belongs in the “JavaScript” control.
  • The “document.write” function does not work — at the moment the custom code runs, the document is already closed and writing into it would overwrite its content.
  • The “window.onload” and “window.onunload” event handlers are raised only on the first load of the page, no longer after an ajax request.
  • A reference to a control must not be stored in a variable for later use — after an ajax request the document contains new nodes and the stored reference points to a node that is no longer in the page. The control has to be looked up again with the “el()” function every time.

Example:

FULLAJAXMODE()
 

string GANTT(DateTime from, DateTime to, int R, int G, int B)

Use: view table

Description: The function displays the Gantt chart on the row of the view table (DataGrid). The start date of the diagram is determined by the “from” parameter, the end date is determined by the “to” parameter. The color of the diagram is determined by the color values of the parameters “R”, “G” and “B”. To display the diagram, the call to the “GANTT” function must be stored in the value of the “TextBox” control with the “String” data type, set to “Read-only” and as “Hidden field”; the diagram is not displayed in the “History” control. The value of the control must begin exactly with the text “GANTT(” and end with a closing parenthesis. If the “to” parameter is empty or cannot be converted to a date, the date from the “from” parameter is used as the end date. An end date without a time includes the whole day, and if “to” is earlier than “from”, the dates are swapped. If the “from” parameter cannot be converted to a date, the diagram is not displayed in the row. Values of “R”, “G” and “B” outside the range 0 to 255 are limited to the nearest bound.

Example:

GANTT(01.01.2013, 01.02.2013, 25, 25, 112)
 

string GETCOOKIE(string key)

Use: HTML, JavaScript, Script

Description: The function returns the cookie value defined by the “key” parameter. The cookie value is supplied by the web browser and the function returns it without encoding; it is therefore inserted into HTML through the “HTMLENCODE” function.

Example:

GETCOOKIE(abc)
 

string GOOGLECAPTCHA(string siteKey, [string url])

Use: HTML in the edit form

Description: The function inserts the Google reCAPTCHA verification code into the HTML code of the edit form, which is used to distinguish real users from robots. The embedded verification code contains a unique domain key specified by the “siteKey” parameter, which can be obtained by registering Google reCAPTCHA with Google. The optional “url” parameter is the address of the Google reCAPTCHA script inserted into the page; if it is not specified, the default address “https://www.google.com/recaptcha/api.js” is used. The function is linked to the “EVALGOOGLECAPTCHA” function, without which the “GOOGLECAPTCHA” function would not make sense.

Note: The function works with a Challenge (v2) key, formerly referred to as “reCAPTCHA v2 Checkbox”, and its verification by the “EVALGOOGLECAPTCHA” function goes through the original (legacy) Google verification endpoint. The result of the verification is only the information whether the check passed or not — the function does not work with a score, that is, with a numeric expression of the probability that the form was submitted by a human. Score keys, which Google recommends today, are not supported by this function.

The implementation procedure — creating the keys with Google as well as wiring the controls in the form — is provided in the separate guide Google reCAPTCHA implementation.

Example:

GOOGLECAPTCHA(5ghjhddfg54cddry5tvggfffg)
 

string GOOGLECAPTCHAINVISIBLE(string siteKey, string button, [string url, string position])

Use: HTML in the edit form

Description: The function inserts the Google reCAPTCHA verification code into the HTML code of the edit form, which is used to distinguish real users from robots. The embedded verification code contains a unique domain key specified by the “siteKey” parameter, which can be obtained by registering Google reCAPTCHA with Google. The “button” parameter is the identifier of the hidden button that contains the “EVALGOOGLECAPTCHA” function — it is written as “BT” and the database ID of the button, for example “BT216”. The button runs on the server side when processing a response from Google. The optional “url” parameter is the address of the Google reCAPTCHA script inserted into the page; if it is not specified, the default address “https://www.recaptcha.net/recaptcha/api.js” is used, which is available even in networks that block the google.com domain. The optional parameter “position” determines the position of the badge and can take the values bottomright, bottomleft and inline. The function is tied to the “EVALGOOGLECAPTCHA” function, without which the “GOOGLECAPTCHAINVISIBLE” function would not make sense.

Note: The function works with an Invisible (v2) key and its verification by the “EVALGOOGLECAPTCHA” function goes through the original (legacy) Google verification endpoint. The result of the verification is only the information whether the check passed or not — the function does not work with a score and does not support score keys.

The check is started by the javascript function “evalGoogleCaptcha()” written into the client event of a separate visible button; the protection therefore requires two buttons — a visible one that starts the check and a hidden one that verifies the response. The implementation procedure is provided in the separate guide Google reCAPTCHA implementation.

Example:

GOOGLECAPTCHAINVISIBLE(5ghjhddfg54cddry5tvggfffg, BT123)
 

object[] GROUP(object[] array)

Use: Script

Description: The function returns the array of values of a script variable of the array type, in which duplicates are removed. The function is written only as the whole value of an assignment step (“GROUP(#A#)”) and its result is always an array of values; if the variable is not an array of values, it returns an array with a single element – the value of the variable. The variable to which the result is assigned has to be declared beforehand, otherwise the script ends with an error. This variable must have the same data type as the variable specified by the “array” parameter – the values are not converted to its data type.

Example:

GROUP(#A#)
 

void HIDEFORM(string message)

Use: Script (where a comment is expected)

Description: The function hides the content of the edit form or view page, and prints the message specified by the “message” parameter. The message can be entered in several languages. Unsafe HTML tags are removed from it unless they are written directly in the function call – a message in which the administrator wrote them (for example <script> with a redirect) is printed unchanged, including the substituted values.

Example:

HIDEFORM("Thank you for sending us your reply.")
 

void HIDEFORM(string message, bool fullscreen)

Use: Script (where a comment is expected)

Description: The function hides the content of the edit form or view page and prints the message specified by the “message” parameter in the same way as the variant with one parameter. If the “fullscreen” parameter has the value “true”, the message is displayed over the whole area of the page. In an edit form with priority HTML code (an HTML control with the “Priority HTML code placed in front of the form” field checked that renders non-empty content), the message is always displayed over the whole area of the page, even with the value “false” and in the variant with one parameter.

Example:

HIDEFORM("Thank you for sending us your reply.", true)
 

string HOURCONDITION(string ng_date, int hour1, int hour2)

Use: HTML, JavaScript, Script

Description: The function returns the SQL code of the condition that is used to compare whether the column named “ng_date” (the content of the column is the date) lies in the time interval between the hours “hour1” and “hour2”. The hour number is compared including both limits, so a condition with the hours “8” and “20” also includes times from 20:00 to 20:59. The value “hour1” must not be greater than “hour2” – a condition with an interval across midnight (for example from 22 to 6) returns no record and has to be composed of two conditions (from “hour1” to 23 and from 0 to “hour2”), at least one of which must hold.

Example:

Use in query condition:
[(ID)] [equal to] [OK#crlf#HOURCONDITION(ng_date, 8, 20)]
There must be no space before OK#crlf#
 

string HTMLDECODE(string text)

Use: HTML, JavaScript, Script

Description: The function replaces all character sequences contained in the “text” parameter with the corresponding HTML characters.

Example:

HTMLDECODE(&lt;h1&gt;Administrator&lt;/h1&gt;)
// Returns “<h1>Administrator</h1>”
HTMLDECODE(&lt;p&gt;Hi, my name is &lt;br&gt;NET Genium&lt;/p&gt;)
// Returns “<p>Hi, my name is <br>NET Genium</p>”
 

string HTMLENCODE(string text)

Use: HTML, JavaScript, Script

Description: The function replaces all HTML characters contained in the “text” parameter with the corresponding character sequence.

Example:

HTMLENCODE(<h1>Administrator</h1>)
// Returns “&lt;h1&gt;Administrator&lt;/h1&gt;”
HTMLENCODE(<p>Hi, my name is <br>NET Genium</p>)
// Returns “&lt;p&gt;Hi, my name is &lt;br&gt;NET Genium&lt;/p&gt;”
 

string HTML2TEXT(string html, bool simplehtml)

Use: HTML, JavaScript, Script

Description: The function converts a text string in HTML format to plain text. The “simplehtml” parameter specifies whether to keep the basic text formatting using the “b”, “strong”, “i”, “em”, “u”, “sub”, “sup” and “blockquote” HTML tags and images (the “img” tag). With the value “false” the function returns plain text, which uses “\r\n” as a line separator. With the value “true” it returns simplified HTML: it separates lines by the “br” tag, writes the “&”, “<”, “>” characters and the double quotation mark as HTML entities and keeps an image only if its address is a link to a NET Genium attachment or begins with “http://”, “https://”, “ftp://”, “ftps://” or “data:”. The function converts a table row to a single line of text, separates the content of non-empty cells by a hyphen surrounded by spaces and inserts an empty line after the table. Preformatted text (the “pre” tag) keeps its line breaks, and its indentation and repeated spaces are kept as non-breaking spaces.

Example:

HTML2TEXT(<div><b>abc</b></div>, true)
// Returns “<b>abc</b>”
 

string HTML2TEXT(string html)

Use: HTML, JavaScript, Script

Description: The function converts a text string in HTML format to plain text, which uses “\r\n” as a line separator. It converts tables and preformatted text in the same way as the variant with the “simplehtml” parameter.

Example:

HTML2TEXT(<div>abc</div>)
// Returns “abc”
 

string IFF(string expression, string yes, string no)

Use: HTML, JavaScript, Script

Description: The function evaluates whether the mathematical expression specified by the “expression” parameter holds true. If the expression is true, the value specified by the “yes” parameter is returned; otherwise, the value specified by the “no” parameter is returned. The function works exclusively with numbers (not text values) and supports the operators “<”, “<=”, “>=”, “>” and “=”. The order of operator evaluation: first “<=” (then “<”), then “>=” (then “>”), finally “=”. Spaces in the expression are ignored (trimmed). If the expression contains no comparison operator, the function always returns the value of the “no” parameter. A value that cannot be converted to a number (for example text) is compared as 0 – a comparison of two texts therefore always results in equality. Texts are compared by the “EQUALS” function, dates by the “COMPAREDATE” function.

Example:

IFF(-1.5 <= 2, True, False)
// Returns “True”
IFF(10 > 5, Greater, Less or equal)
// Returns “Greater”
IFF(3 = 3, Equal, Not equal)
// Returns “Equal”
IFF(#A# >= #B#, YES, NO)
// Returns “YES” or “NO” depending on the values of the script variables A and B
IFF(0 = 1, Never, Always)
// Returns “Always” (the condition 0 = 1 is not met)
IFF(no_operator, Yes, No)
// Returns “No” – no operator › condition cannot be evaluated
 

void IMPORTFORMDATAFROMXMLFILE(string path [, string column1, string column2, ...])

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function reads an XML file from disk specified by the “path” parameter (typically generated by the EXPORTFORMDATATOXMLFILE function) and imports data from the first row of the first DataSet table into the currently open edit form. System columns and columns that the form does not contain are skipped. The optional “column1”, “column2”, ... parameters restrict the import to only the specified columns; without them all columns are imported. If the file contains none of the specified columns, nothing is imported. After the import, the file is automatically deleted, even if nothing was imported; if the function ends with an error (for example a file without data or with invalid XML content), the file remains. Depending on the environment of the instance, the path may be restricted to allowed directories; an attempt to access a path outside them then throws an exception.

Example:

IMPORTFORMDATAFROMXMLFILE(#rootpath#Temp\data.xml)
// Imports all data from the file data.xml into the current form
IMPORTFORMDATAFROMXMLFILE(#rootpath#Temp\data.xml, ng_firstname, ng_lastname, ng_email)
// Imports only the columns ng_firstname, ng_lastname and ng_email
IMPORTFORMDATAFROMXMLFILE(#rootpath#Temp\data.xml)
// Throws an exception if the path does not pass validation or the file contains no data; a non-existent file is silently skipped
 

int INDEXOF(string text, string subtext)

Use: HTML, JavaScript, Script

Description: The function returns the position of the substring specified by the “subtext” parameter in the string specified by the “text” parameter, starting with the index “0”. If no such occurrence is found, it returns the value “-1”. The form “indexOf” is not evaluated and is preserved for the browser; other forms (INDEXOF, indexof) work.

Example:

INDEXOF(Good morning, morning)
// Returns “5”
 

string INT2TIME(int minutes)

Use: HTML, JavaScript, Script

Description: The function returns a text string in the format “HH:mm” expressed from the number of minutes specified by the “minutes” parameter. The number of hours does not wrap after 24 hours (1500 minutes returns “25:00”) and a negative number of minutes returns a time with a minus sign (e.g. “-01:30”).

Example:

INT2TIME(480)
// Returns “08:00”
INT2TIME(0)
// Returns “00:00”
 

int[] IntegerArray(int count)

Use: Script

Description: The function declares a script variable of the “Integer” value field type, and creates an array of as many elements as specified by the “count” parameter. It fills these elements with values gradually from one, each element has a stored value one higher than the previous element. The “IntegerArray” function call must be case sensitive in the function name and must form the whole value assigned to the variable. A negative value of the “count” parameter terminates the script with an error; zero or a non-numeric value creates an empty array.

Example:

IntegerArray(5)
 

string JTSK2WGS(double x, double y)

Use: HTML, JavaScript, Script

Description: The function returns the conversion of the JTSK coordinate system values specified by the “x” and “y” parameters to the WGS system. The result is the longitude followed by the latitude, separated by a semicolon. The decimal separator of both values follows the language of the logged-in user – a decimal comma for a user with the Czech language, a decimal point for a user with the English language.

Example:

JTSK2WGS(x, y)
// Returns “longitude;latitude”
 

void LABELPOSITION(string position)

Use: Note of a database control in the edit form

Description: The function determines the position of the name of a database control. The value “inside” displays the name inside the control, the value “up” above the control; the value is written in lower case. Controls that cannot display the name inside (e.g. RichTextBox, MultiListBox, Radio, CheckBox, File, Image or DatePicker) display it above themselves with the value “inside”.

Example:

LABELPOSITION(inside)
LABELPOSITION(up)
 

void LABELSINSIDE()

Use: Note of the edit form, Note of the view page

Description: The function displays the labels of controls inside the controls, so the edit form or the view page has no left column with the names of controls. On a view page, the RichTextBox control displays its label above the field. In the edit form, the controls that cannot display the label inside (RichTextBox, MultiListBox, Radio, CheckBox, File, Image, DatePicker, ListBox outside mobile devices, ForeignKey displayed as text or a link, TextBox and TextArea with a width of 0 pixels and TextArea with a data type other than “Text string”) display it above themselves.

Example:

LABELSINSIDE()
 

string LANGUAGE(string loginname)

Use: HTML, JavaScript, Script

Description: The function returns the code of the language stored for the user specified by the “loginname” parameter, typically “cs”, “de”, “en”, “fr” or “sk”. If the user has no language set, it returns an empty string.

Example:

LANGUAGE(Administrator)
LANGUAGE(#loginname#)
 

object LAST(object[] array)

Use: Script

Description: The function returns the last value of the script variable specified by the “array” parameter if the variable is an array of values. If the variable is not an array of values, then the function returns the value of the variable. If the value field does not contain any element, the function returns an empty string.

Example:

LAST(#A#)
 

DateTime LASTDAYINMONTH(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the last day of the month from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

LASTDAYINMONTH(15.2.2013)
// Returns “28.02.2013”
LASTDAYINMONTH(#today#)
 

DateTime LASTDAYINQUARTAL(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the last day of the quarter from the date specified by the “date” parameter. For an invalid date it returns an empty string. The function is also available under the alternative name “LASTDAYINQUARTER”.

Example:

LASTDAYINQUARTAL(15.2.2013)
// Returns “31.03.2013”
LASTDAYINQUARTER(15.5.2013)
// Returns “30.06.2013” (alternative name)
LASTDAYINQUARTAL(#today#)
 

DateTime LASTDAYINWEEK(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the last day of the week (Sunday; the week starts on Monday) from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

LASTDAYINWEEK(15.2.2013)
// Returns “17.02.2013”
LASTDAYINWEEK(#today#)
 

DateTime LASTDAYINYEAR(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the date of the last day of the year from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

LASTDAYINYEAR(15.2.2013)
// Returns “31.12.2013”
LASTDAYINYEAR(#today#)

void LAYOUT(int id)

Use: Note of the edit form, Note of the view page

Description: The function sets the layout of the current edit form or view page according to the definition stored in the “slayout” table. Together with the layout, it also takes over its “Form – Margins” and overwrites with them the margins set by the “MARGINS” function written before it in the note – the functions are evaluated in the order in which they are written in the note. The “MARGINS” function therefore has to be written after the “LAYOUT” function. The “id” parameter specifies the identifier of the layout that will be applied to the form or the view page. By using this function, the default layout applied to the entire application can be changed dynamically without modifying its definition.

Example:

LAYOUT(2)
// Layout 2 with a custom left margin
LAYOUT(2) MARGINS(auto, auto, auto, 100)
 

void LEFTALIGNMENT

Use: Note of the edit form or HTML control name (the body of the control must be left blank)

Description: The function starts a block of controls that have the control name left-aligned in the left column. In user mode, buttons, the DataGrid and LiteDataGrid view tables and the Calendar, TimeTable, Planner, Kanban, Chart, Map and Tree visual controls that are not snapped to the previous control are displayed in the block without the left column with the name, starting at the left edge of the form.

Example:

// In the note of the edit form, the function is written with parentheses
LEFTALIGNMENT()
// In the name of an HTML control, it is written without parentheses; “LEFTALIGNMENT()” has no effect there
LEFTALIGNMENT
 

void /LEFTALIGNMENT

Use: HTML control name – The body of the control must be left blank

Description: The function ends the block of controls that have the control name left-aligned in the left column.

Example:

/LEFTALIGNMENT
 

int LENGTH(string text)

Use: HTML, JavaScript, Script

Description: The function returns the length (number of characters) of the text string specified by the “text” parameter.

Example:

LENGTH(Administrator)
// Returns “13”
LENGTH(#loginname#)
LENGTH(#A#)
 

void LOADDATAGRIDSETTINGS(int query, int form, int id)

Use: Script (where a comment is expected)

Description: The function loads previously saved data grid settings for the query specified by the “query” parameter (query ID) from the record storage specified by the “form” (form ID) and “id” (record ID) parameters, and applies it to the current filter of the logged-in user. Column filters apply only to the columns the user has displayed in the view table; a user who has not displayed the table yet first gets the default columns if column filters are saved. For the anonymous user the column filters, the search selection in individual columns and the conditions of the composed filter are written to its account, which all anonymous visitors share; the column filters and the search selection then apply to all of them. If no settings are saved for the record, the function leaves the user's settings unchanged. Typical use is for sharing filter settings within a specific record. The function reads from the tables of the optional “DataGrid Settings” application, which has to be imported into NET Genium, see the NET Genium settings guide.

Example:

LOADDATAGRIDSETTINGS(#lastqueryid#, #pform#, #pid#)
// Loads the settings saved for the current record and applies them to the current user
 

double LOG10(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the logarithm of base 10 from the value specified by the “number” parameter. The values specified by the “number” parameter can be any non-negative numbers (even decimal). If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

LOG10(1.123)
// Returns “0,0503797562614578”
LOG10(0)
// Returns “-infinity”
 

void LOGERROR(string message)

Use: HTML, JavaScript, Script

Description: The function writes the error message specified by “message” to the current NET Genium log file. If a valid service e-mail address outside the “netgenium.com” domain is filled in in the NET Genium settings, the function also sends the message to it by e-mail, the same message at most once an hour; in a test run of the script the e-mail is not sent.

Example:

LOGERROR(Data import failed.)
 

void LOGNOTICE(string message)

Use: HTML, JavaScript, Script

Description: The function writes the informational message specified by “message” to the current NET Genium log file.

Example:

LOGNOTICE(Data import completed.)
 

void LOGSERVICE(string service)

Use: Script

Description: The function logs the successful execution of a service named “service” to the database table “ng_sluzbawindows”. The write is performed immediately, outside the script transaction, so it is advisable to call the function only on the last line of the script – otherwise the service is logged as working even if the script fails later. If the portal has no form with the “ng_sluzbawindows” table, the function does nothing; the overview and the notifications are provided by the application built on this table. The feature finds use mainly in scheduled script execution using scheduled Windows tasks. The function writes the time of logging and the time of the next expected run, which lies 1 day (1440 minutes) after the logging; the application uses this time to evaluate whether the service is running.

Example:

LOGSERVICE(RunScript)
 

void LOGSERVICE(string service, int interval)

Use: Script

Description: The function logs the successful execution of a service named “service” to the database table “ng_sluzbawindows”. The write is performed immediately, outside the script transaction, so it is advisable to call the function only on the last line of the script – otherwise the service is logged as working even if the script fails later. If the portal has no form with the “ng_sluzbawindows” table, the function does nothing; the overview and the notifications are provided by the application built on this table. The feature finds use mainly in scheduled script execution using scheduled Windows tasks. The function writes the time of logging and the time of the next expected run, which lies the number of minutes specified by the “interval” parameter after the logging; the application uses this time to evaluate whether the service is running.

Example:

LOGSERVICE(RunScript, 720)
 

void LOGVERBOSE(string message)

Use: HTML, JavaScript, Script

Description: The function logs the text string “message” in the file “Logs\yyyy-MM-dd.log”. At the beginning of the line is the word VERBOSE, then the current date and time in the format “yyyy-MM-dd HH:mm:ss”, and then the text string “message” follows.

Example:

LOGVERBOSE(abc)
 

DateTime LONG2DATE(long value)

Use: HTML, JavaScript, Script

Description: The function returns the date and time corresponding to the numeric value specified by the “value” parameter in the form returned by the “DATE2LONG” function – it is the number of 100-nanosecond intervals since 1.1.0001 (the “ticks” value in .NET), not Unix time. The result is in the date and time format of the currently logged in user; the time 00:00 is not output. For the value “0”, a non-numeric value and a value that does not correspond to a valid date, the function returns an empty string.

Example:

LONG2DATE(630822816000000000)
// Returns “01.01.2000”
 

long[] LongArray(long number1; long number2; ...)

Use: Script

Description: The function declares a script variable of the “Long” array type from the individual values specified by the “number1”, “number2”, etc. parameters. The function parameters are separated by a semicolon or a tab. The “LongArray” function call must respect the upper and lower case letters in the function name.

Example:

LongArray(1;2;3)
// Declares an array of three “Long” values
 

string LOWER(string text)

Use: HTML, JavaScript, Script

Description: The function returns the text string specified by the “text” parameter, in which all characters are converted to lowercase.

Example:

LOWER(NET Genium)
// Returns “net genium”
 

string LOWRES(string text1, string text2)

Use: HTML, JavaScript, Script

Description: The function returns the text string specified by the “text1” parameter if the user is logged in to NET Genium on a low-resolution mobile device (“Small screen” is selected when logging in). If the above condition is not met, the function returns the string specified by the “text2” parameter. The function is used for setting the dimensions of controls in the edit form for different types of devices (mobile and non-mobile).

Example:

LOWRES(abc, def)
// Returns “abc” for low resolution mobile devices
// Returns “def” for non-mobile or high-resolution mobile devices
 

void LOWRESOLUTION()

Use: Note of the edit form

Description: The function sets the low resolution of the mobile device so that edit forms are displayed optimized for low resolution even in anonymous mode. By default, the choice of low or high resolution is located on the main page in the login window, but for anonymous edit forms this method is not relevant. The low resolution applies only on a mobile device. The function turns it on for every user who opens the form, until the end of their session – even after leaving the form and even if the user chose “Big screen” when logging in.

Example:

LOWRESOLUTION()
 

void MARGINS(string top, string right, string bottom, string left)

Use: Note of the edit form, Note of the view page

Description: The function sets the size of the margins of the edit form or the view page. The values of the parameters “top”, “right”, “bottom” and “left” are given in pixels, or they can contain the value “auto”, which indicates the default value. The function applies only with all four parameters. The value “auto” has to be written in lower case; any other spelling is evaluated as 0. The unit “px” can follow the number. If the note also contains the “LAYOUT” function, the “MARGINS” function has to be written after it, otherwise the margins are overwritten by the layout selected by the “LAYOUT” function.

Example:

MARGINS(auto, auto, auto, 100)
 

object MAX(object[] array)

Use: Script

Description: The function returns the highest value of the script variable specified by the “array” parameter, if the variable is an array of values. If the variable is not an array of values, the function returns the value of the variable; for a variable of the “String” type it converts the value to a number of minutes (see below). The function works with numbers, time values in the “HH:mm” format and with dates (in which case it returns the latest date). The function skips empty elements of the array. If the array does not contain any non-empty element, the function returns “0”. The function returns a decimal number with a decimal point. It returns a date in the date and time format of the logged-in user with seconds; the time “00:00:00” is omitted and zero seconds are not output.

The function takes the values of a variable of the “String” type as time values in the “HH:mm” format and returns the result as a number of minutes, even for a variable that is not an array of values. Text in another form – including a number stored in a variable of the “String” type – counts as 0; for numbers a variable of the “Integer”, “Long” or “Double” type must therefore be used.

Example:

MAX(#A#)
// Returns the highest value of the array, e.g. for the array [1, 2, 3, 4, 5] it returns “5”
 

double MEASUREWORKDAYS(DateTime startdate, DateTime enddate)

Use: HTML, JavaScript, Script

Description: The function returns the number of working days from the time period specified by the “startdate” and “enddate” parameters. The function takes into account public holidays registered in the basic application “Settings”. Both boundary days are included in the period regardless of the time, a holiday for only part of the day counts as 0.5 day, and if “startdate” is later than “enddate”, the function returns “0”. If either date is invalid, the function returns an empty string.

Example:

MEASUREWORKDAYS(1.1.2000, 1.2.2000)
// Returns “22”
MEASUREWORKDAYS(#ng_from#, #ng_to#)
// Returns the number of working days between the dates in fields “ng_from” and “ng_to”
 

double MEASUREWORKDAYS(string value, string period)

Use: HTML, JavaScript, Script

Description: The function returns the number of working days in the period to which the value specified by the “value” parameter belongs. The “period” parameter determines the period and takes one of the following values:

  • “d” – the day specified by the date in the “value” parameter (returns 1 for a working day, 0.5 for a day with a part-day holiday, otherwise 0)
  • “w” – the week specified in the “value” parameter in the form “year / week number” (e.g. “2026 / 13”)
  • “m” – the calendar month specified in the “value” parameter in the form “year / month” (e.g. “2026 / 03”)
  • “q” – the calendar quarter specified in the “value” parameter in the form “year / quarter number” (e.g. “2026 / 02”)
  • “y” – the calendar year specified by the year number in the “value” parameter

For the “d” period the function returns an empty string for an invalid date; for the other periods a value in another form either returns an incorrect result without an error message (for example a date for the “w”, “m” or “q” period), or ends with an error (for example a date for the “y” period or a month outside the range 1–12 for the “m” period). The function takes into account the public holidays recorded in the basic “Settings” application.

Example:

MEASUREWORKDAYS(#today#, d)
// Returns 1 if today is a working day
MEASUREWORKDAYS(2026 / 03, m)
// Returns the number of working days in March 2026
MEASUREWORKDAYS(2026, y)
// Returns the number of working days in 2026
 

double MEASUREWORKHOURS(DateTime startdate, DateTime enddate)

Use: HTML, JavaScript, Script

Description: The function returns the number of working hours from the time period specified by the “startdate” and “enddate” parameters. The function does not count weekends and days with a public holiday registered in the basic application “Settings”, not even a holiday for only part of the day, which it treats as a non-working day as a whole; working hours are set at 24 hours a day. An end date with the time 00:00 (or without time) is taken as the end of the same day, so the whole day is counted in the period. If either date is invalid, the function returns an empty string; if “startdate” is later than the end of the time period, it returns “0”.

Example:

MEASUREWORKHOURS(1.1.2000, 1.2.2000)
// Returns “528”
 

double MEASUREWORKHOURS(DateTime startdate, DateTime enddate, int starthour, int endhour)

Use: HTML, JavaScript, Script

Description: The function returns the number of working hours from the time period specified by the “startdate” and “enddate” parameters. The function takes into account the working hours specified by the parameters “starthour” and “endhour” and does not count weekends and days with a public holiday registered in the basic application “Settings”, not even a holiday for only part of the day, which it treats as a non-working day as a whole. The “starthour” parameter can take the values 0 to 23 and the “endhour” parameter the values 1 to 24; a value outside the range is replaced by 0 or 24 respectively. A start time before “starthour” is moved to “starthour” and an end time after “endhour” is shortened to “endhour”; an end date with the time 00:00 (or without time) is taken as the end of the working hours of the same day, so the whole day is counted in the period. If either date is invalid, the function returns an empty string; if “startdate” is later than the end of the time period (an end after the “endhour” hour is taken as “endhour” of the same day) or “starthour” is greater than “endhour”, it returns “0”.

Example:

MEASUREWORKHOURS(13.2.2026 9:30, 13.2.2026 12:00, 8, 18)
// Returns “2,5”
 

object MIN(object[] array)

Use: Script

Description: The function returns the lowest value of the script variable specified by the “array” parameter, if the variable is an array of values. If the variable is not an array of values, the function returns the value of the variable; for a variable of the “String” type it converts the value to a number of minutes (see below). The function works with numbers, time values in the “HH:mm” format and with dates (in which case it returns the earliest date). The function skips empty elements of the array. If the array does not contain any non-empty element, the function returns “0”. The function returns a decimal number with a decimal point. It returns a date in the date and time format of the logged-in user with seconds; the time “00:00:00” is omitted and zero seconds are not output.

The function takes the values of a variable of the “String” type as time values in the “HH:mm” format and returns the result as a number of minutes, even for a variable that is not an array of values. Text in another form – including a number stored in a variable of the “String” type – counts as 0; for numbers a variable of the “Integer”, “Long” or “Double” type must therefore be used.

Example:

MIN(#A#)
// Returns the lowest value of the array, e.g. for the array [1, 2, 3, 4, 5] it returns “1”
 

string MINUTES2TIME(int minutes)

Use: HTML, JavaScript, Script

Description: The function returns a text string in the format “HH:mm” expressed from the number of minutes specified by the “minutes” parameter. The number of hours does not wrap after 24 hours (1500 minutes returns “25:00”) and a negative number of minutes returns a time with a minus sign (e.g. “-01:30”).

Example:

MINUTES2TIME(480)
// Returns “08:00”
MINUTES2TIME(0)
// Returns “00:00”
 

int MONTH(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the month number from the date specified by the “date” parameter. For an invalid date it returns an empty string.

Example:

MONTH(15.2.2013)
// Returns “2”
MONTH(#now#)
 

string NGDPH()

Use: HTML, JavaScript, Script

Description: The function returns the current VAT rates of the Czech Republic separated by a semicolon; the zero rate “0” is always listed after the rates. The rates of other countries are returned by the “NGVATRATES” function.

Example:

NGDPH()
 

double NGDPH(int rate)

Use: HTML, JavaScript, Script

Description: The function returns the VAT rate of the Czech Republic defined by the “rate” parameter. The parameter is defined by number 2 for the increased VAT rate, number 1 for the reduced VAT rate, number 3 for the second and number 4 for the third reduced VAT rate (if the Czech Republic does not have them, the function returns 0) and number 0 for the zero VAT rate.

Example:

NGDPH(1)
// Returns current reduced VAT rate, e.g. “12”
 

string NGDPH(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns VAT rates of the Czech Republic separated by a semicolon on the day specified in the “date” parameter; the zero rate “0” is always listed after the rates. The date is read according to the date format of the logged-in user; for a date that cannot be recognized, the function returns an empty string.

Example:

NGDPH(1.1.2000)
// Returns semicolon-separated VAT rates valid on a given day, e.g. “22;5;0”
 

double NGDPH(int rate, DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the VAT rate of the Czech Republic defined by the “rate” parameter. The parameter is defined by number 2 for the increased VAT rate, number 1 for the reduced VAT rate, number 3 for the second and number 4 for the third reduced VAT rate (if the Czech Republic does not have them, the function returns 0) and number 0 for the zero VAT rate. The rate is determined on the day specified in the “date” parameter. The date is read according to the date format of the logged-in user; for a date that cannot be recognized, the function returns an empty string. The “date” parameter can also be specified as a year (“2024”) or as a year and month in the form “2024 / 03”; the first day of the year or month is used. A four-character value is always read as a year and a value in the form “yyyy / mm” as a year and month; if they do not correspond to a valid year (1 to 9999) and month (1 to 12), for example “2024 / 13”, the function returns “0”.

Example:

NGDPH(2, 1.1.2000)
// Returns increased VAT rate on a given day, e.g. “22”
 

double NGDPH(double base, string type1, double rate, string type2)

Use: HTML, JavaScript, Script

Description: The function calculates either the amount or the VAT value, depending on the “type2” parameter. The basic amount defined by the “base” parameter, rounded to two decimal places, and the VAT rate defined by the “rate” parameter are used for the calculation. The “type1” parameter specifies the value of the “base” parameter. The returned amount has the decimal separator according to the language of the logged-in user – a decimal comma for a user with the Czech language and a decimal point for a user with the English language.

Possible values for the “type1” parameter:

  • bezdph – parameter 1 is the sum without VAT
  • sdph – parameter 1 is the amount with VAT

Possible values for the “type2” parameter:

  • bezdph – calculates the tax base
  • dph – calculates the value of VAT
  • zdph – calculates the VAT value worked out so that the amount including VAT is rounded up to a whole number
  • dph1 – calculates the VAT value if the “rate” is greater than 0 and at most 15 % (reduced rate); otherwise returns 0
  • zdph1 – calculates the VAT value worked out so that the amount including VAT is rounded up to a whole number, if the “rate” is greater than 0 and at most 15 %; otherwise returns 0
  • dph2 – calculates the VAT value if the “rate” is greater than 15 % and less than 100 % (increased rate); otherwise returns 0
  • zdph2 – calculates the VAT value worked out so that the amount including VAT is rounded up to a whole number, if the “rate” is greater than 15 % and less than 100 %; otherwise returns 0
  • sdph – calculates the amount with VAT
  • zsdph – calculates the amount with VAT rounded up to a whole number
  • zsdph-1 – calculates the amount with VAT rounded mathematically to an integer
  • zsdph-2 – calculates the amount with VAT rounded to 50 hellers (negative amounts symmetrically by absolute value)

Rounding up for the values “zdph”, “zdph1”, “zdph2” and “zsdph” means rounding towards positive numbers, so a negative amount including VAT is rounded towards zero (for example -112.40 to -112).

If the “type1” parameter equals “sdph”, only the values “bezdph”, “dph”, “dph1”, “dph2” and “sdph” can be used as the “type2” parameter; the other values return 0. The letter case of the values of the “type1” and “type2” parameters does not matter; any other value of the “type1” or “type2” parameter returns 0.

The optional fifth parameter with the value “true” switches the calculation for the “type1” parameter equal to “bezdph” into the VAT settlement mode: the values “dph”, “zdph”, “dph1”, “zdph1”, “dph2” and “zdph2” return 0, the values “bezdph”, “sdph” and “zsdph” return the VAT value rounded to two decimal places, “zsdph-1” the VAT value rounded mathematically to a whole number and “zsdph-2” the VAT value rounded to 50 hellers.

Example:

NGDPH(-10.55, bezdph, 19, sdph)
// Returns “-12.55”
NGDPH(100, sdph, NGDPH(1), dph)
 

string ngef(string id, string arg0, string arg1, string arg2, ...)

Use: HTML, JavaScript, Script

Description: The function starts the external function specified by the “id” parameter and returns its return value. Parameters “arg0”, “arg1”, “arg2” etc. are passed to the external function as “string[] args”.

The “id” parameter is not part of the “args” array. The “args” array contains only the parameters written after the “id” parameter, and therefore always has one element fewer than the number of parameters of the “ngef” call itself. The “arg0” parameter corresponds to the “args[0]” element, the “arg1” parameter to the “args[1]” element and so on. If the “ngef” function is called with the “id” parameter only, the “args” array is empty and its “Length” property is zero.

All parameters are passed to the external function as text, even if they have the form of a number or a date. An omitted parameter is passed as an empty string and the number of elements of the “args” array is not affected.

A detailed description of external functions is provided in the separate guide External functions.

Example:

ngef(MyFirstFunction, A, B, C, 1, 2, 3, 1.1.2000, ...)
ngef(MyFirstFunction, A, B, C)
// id = “MyFirstFunction”, args.Length = 3
// args[0] = “A”, args[1] = “B”, args[2] = “C”
ngef(MyFirstFunction)
// id = “MyFirstFunction”, args.Length = 0
ngef(MyFirstFunction, A, , C)
// id = “MyFirstFunction”, args.Length = 3
// args[0] = “A”, args[1] = “”, args[2] = “C”
 

string ngef2(string id, string arg0, string arg1, string arg2, ...)

Use: Visual controls

Description: The function starts the external function specified by the “id” parameter in the visual control, and returns its return value. Parameters “arg0”, “arg1”, “arg2” etc. they are passed to the external function as “string[] args”. To run the external function itself, the call to the “ngef2” function must be stored in the value of the “TextBox” or “TextArea” control, set to “Read-only” and as “Hidden field”. “TextBox” and “TextArea” controls that have the external function call “ngef2” set as the default value, and at the same time have the default value filled in every time the edit form opens up, may have an empty value in the database, and the external function set as the default value is still evaluated when the record is displayed outside the edit form (for example in a view table, tree, calendar, picker, export, print template or the body of an e-mail; but not in an export with the “Disable evaluation of external functions” check box selected or in an export for re-import from Excel). The default value is used in this way only if it contains no variables (the “#” character). When calling the “ngef2” function, the last parameter with the ID of the displayed record is automatically added; in the external function the ID of the displayed record is therefore the last element of the “args” array, and the array has one element more than the number of parameters written after the “id” parameter in the call. Otherwise the number and order of the parameters are the same as for the “ngef” function. Only a value that forms a single “ngef2” call is evaluated. The parameters are passed to the external function literally, so nested function calls and variables are not evaluated in them; a value that is not a single call, or that contains a double quotation mark in a parameter not entirely enclosed in double quotation marks, is displayed by NET Genium as text. The value of a read-only control whose default value begins with an “ngef2” call cannot be changed by JavaScript in the form. If a script writes an “ngef2” call into the control, the “Disable value assignment using JavaScript” check box must be selected for the control, otherwise the user can change the value in the form.

Example:

ngef2(MyFirstFunction, A, B, C, 1, 2, 3, 1.1.2000, 123, ...)
ngef2(MyFirstFunction, A, B)
// id = “MyFirstFunction”, args.Length = 3
// args[0] = “A”, args[1] = “B”, args[2] = ID of the displayed record
 

string NGVAT()

Use: HTML, JavaScript, Script

Description: The function returns a semicolon-separated list of all states for which the “NGVAT” function can be used with parameters.

Example:

NGVAT()
// Returns “Afghanistan;Albania;Algeria;American Samoa;Andorra;Angola;Anguilla;Antarctica;Antigua and Barbuda;Argentina;Armenia;Aruba;Australia;Austria;Azerbaijan;Bahamas;Bahrain;Bangladesh;Barbados;Belarus;Belgium;Belize;Benin;Bermuda;Bhutan;Bolivia;Bosnia and Herzegovina;Botswana;Bouvet Island;Brazil;British Indian Ocean Territories;Brunei Darussalam;Bulgaria;Burkina Faso;Burundi;Cambodia;Cameroon;Canada;Cape Verde;Cayman Islands;Central African Republic;Chad;Chile;China, People's Republic of;Christmas Island;Cocos Islands;Colombia;Comoros;Congo;Cook Islands;Costa Rica;Cote D'ivoire;Croatia;Cuba;Cyprus;Czech Republic;Denmark;Djibouti;Dominica;Dominican Republic;East Timor;Ecuador;Egypt;El Salvador;Equatorial Guinea;Eritrea;Estonia;Ethiopia;Falkland Islands;Faroe Islands;Fiji;Finland;France;French Guiana;French Polynesia;French Southern Territories;FYROM;Gabon;Gambia;Georgia;Germany;Ghana;Gibraltar;Greece;Greenland;Grenada;Guadeloupe;Guam;Guatemala;Guinea;Guinea-Bissau;Guyana;Haiti;Heard Island And Mcdonald Islands;Honduras;Hong Kong;Hungary;Iceland;India;Indonesia;Iran;Iraq;Ireland;Israel;Italy;Jamaica;Japan;Jordan;Kazakhstan;Kenya;Kiribati;Korea, Democratic People's Republic of;Korea, Republic of;Kuwait;Kyrgyzstan;Lao Peoples Democratic Republic;Latvia;Lebanon;Lesotho;Liberia;Libyan Arab Jamahiriya;Liechtenstein;Lithuania;Luxembourg;Macau;Madagascar;Malawi;Malaysia;Maldives;Mali;Malta;Marshall Islands;Martinique;Mauritania;Mauritius;Mayotte;Mexico;Micronesia;Moldova;Monaco;Mongolia;Montenegro;Montserrat;Morocco;Mozambique;Myanmar;Namibia;Nauru;Nepal;Netherlands;Netherlands Antilles;New Caledonia;New Zealand;Nicaragua;Niger;Nigeria;Niue;Norfolk Island;Northern Mariana Islands;Norway;Oman;Pakistan;Palau;Panama;Papua New Guinea;Paraguay;Peru;Philippines;Pitcairn;Poland;Portugal;Puerto Rico;Qatar;Reunion;Romania;Russian Federation;Rwanda;Saint Helena;Saint Kitts and Nevis;Saint Lucia;Saint Pierre and Miquelon;Saint Vincent and The Grenadines;Samoa;San Marino;Sao Tome and Principe;Saudi Arabia;Senegal;Serbia;Seychelles;Sierra Leone;Singapore;Slovakia;Slovenia;Solomon Islands;Somalia;South Africa;South Georgia and Sandwich Islands;Spain;Sri Lanka;Sudan;Suriname;Svalbard and Jan Mayen;Swaziland;Sweden;Switzerland;Syrian Arab Republic;Taiwan;Tajikistan;Tanzania;Thailand;Togo;Tokelau;Tonga;Trinidad and Tobago;Tunisia;Turkey;Turkmenistan;Turks and Caicos Islands;Tuvalu;Uganda;Ukraine;United Arab Emirates;United Kingdom;Uruguay;USA;Uzbekistan;Vanuatu;Vatican City State;Venezuela;Vietnam;Virgin Islands (British);Virgin Islands (U.S.);Wallis And Futuna Islands;Western Sahara;Yemen;Zaire;Zambia;Zimbabwe”
 

double NGVAT(double base, DateTime date, string country, string dic)

Use: HTML, JavaScript, Script

Description: The function returns the calculated amount of VAT that must be paid when delivering the goods to the country specified by the “country” parameter. The “base” parameter defines the monetary base. The “date” parameter defines the date of the taxable supply and the “dic” parameter defines the VAT number of the customer. The date is read according to the date format of the logged-in user; for a date that cannot be recognized, the function returns an empty string. If the customer does not have an assigned VAT number, the parameter will be empty. The returned amount is not rounded and its decimal separator follows the language of the logged-in user.

The country is specified by a name from the list returned by the “NGVAT” function without parameters, or by a two-letter ISO 3166-1 code (CZ, DE, ...). The function returns VAT at the standard rate of the Czech Republic for the Czech Republic and for a country that is a member of the European Union on the date of the taxable supply, provided that the “dic” parameter is empty. In all other cases, including an unknown country, it returns 0.

Example:

NGVAT(1500.20, #today#, Germany, DE123456789)
NGVAT(1500.20, #today#, DE, DE123456789)
 

string NGVATRATES(string country)

Use: HTML, JavaScript, Script

Description: The function returns VAT rates separated by a semicolon in the given country (CZ, DE, HU, SK, ...) specified by the “country” parameter, valid on the current day. The zero rate “0” is always listed after the rates. A decimal rate is written with the decimal separator according to the language of the logged-in user. If the “country” parameter is empty, the Czech Republic is used. The function knows the rates only for the member states of the European Union, and the country code has to be written in upper case; for another country or a code written in lower case the function returns an empty string.

Example:

NGVATRATES(DE)
// Returns the VAT rates valid in Germany on the current day, e.g. “19;7;0”
 

string NGVATRATES(string country, DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns VAT rates separated by a semicolon in the given country (CZ, DE, HU, SK, ...) specified by the “country” parameter, and on the given date specified by the “date” parameter. The date is read according to the date format of the logged-in user; for a date that cannot be recognized, the function returns an empty string. Greece can be specified by the code GR or EL. A decimal rate is written with the decimal separator according to the language of the logged-in user. If the “country” parameter is empty, the Czech Republic is used. The function knows the rates only for the member states of the European Union, and the country code has to be written in upper case; for another country or a code written in lower case the function returns an empty string.

Details

For the states BE, BG, DK, ES, FR, HR, IT, PT and SE the table of rates holds only the current rates, and for the other states it covers only selected earlier changes; for a date in the past the function may therefore return rates that were not valid on that date.

Example:

NGVATRATES(DE, 5.5.2012)
// Returns “19;7;0”
 

void NOBACKGROUND

Use: Note of the edit form or HTML control name (the body of the control must be left blank)

Description: The function starts a block of controls that do not use the colored background in the left column with the control's name. In user mode, buttons, the DataGrid and LiteDataGrid view tables and the Calendar, TimeTable, Planner, Kanban, Chart, Map and Tree visual controls that are not snapped to the previous control are displayed in the block without the left column with the name, starting at the left edge of the form. A started block that is not terminated with the “/NOBACKGROUND” function anchors the “Save”, “Delete” and “Back” buttons. These buttons will then not be floating, and will always be displayed at the end of the edit form.

Example:

// In the note of the edit form, the function is written with parentheses
NOBACKGROUND()
// In the name of an HTML control, it is written without parentheses; “NOBACKGROUND()” has no effect there
NOBACKGROUND
 

void /NOBACKGROUND

Use: HTML control name - The body of the control must be left blank

Description: The function ends a block of controls that do not use the colored background in the left column with the control's name.

Example:

/NOBACKGROUND
 

void OBSOAS(int form, int id)

Use: Script (where a comment is expected)

Description: The function loads the record specified by the “id” parameter in the edit form specified by the “form” parameter, and runs the OnBeforeSave and then OnAfterSave scripts.

  • The “form” parameter can contain the ID or the identifier of the edit form, the “id” parameter one ID or a list of IDs separated by a semicolon; records that do not exist are skipped.
  • Each record is processed and committed separately (the “OnBeforeSave” script together with saving the record in one transaction, the “OnAfterSave” script in another one), so a later error of the calling script does not undo it. An error in the “OnBeforeSave” or “OnAfterSave” script of the processed record, on the other hand, ends the calling script – the remaining records are not processed and the records processed before stay saved. If only the “OnAfterSave” script ends with an error, the processed record stays saved as well.
  • The function reads only committed data. Writes of the calling script that the scripts of the record are to see have to be committed beforehand by the “COMMIT()” function.
  • The function does not fill in default values and does not perform form validation. It respects disabled scripts on the form and the “SKIPSAVE()” function; navigation scheduled in the scripts of the record is not performed. Scripts scheduled by the “SCHEDULESCRIPT” function in the “OnAfterSave” script of the processed record are run right after it is saved and their error does not interrupt the calling script, it is only written to the “Errors.log” log file; scripts scheduled in the “OnBeforeSave” script are not run.
  • The function is not performed in test mode or in demo mode (the “Config\Demo.txt” file).
  • Calling the function over the same form from its own “OnBeforeSave” or “OnAfterSave” scripts results in an endless loop.

Example:

A = StringArray(SQL("SELECT id FROM ng_form",;))
Cycle: For each A
OBSOAS(123, #A#)
Next...
 

int OCR2FILE(string path, string type)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function OCR converts the text from the file specified by the “path” parameter, and creates a new file attachment defined by the “type” parameter. The conversion is always performed by the OCR server, including MS Word and Excel files; native conversion of these files is offered only by the OCR2TEXT and OCR2HTML functions. If the OCR server creates more files, the result is an attachment in ZIP format. The function is not executed in a test run of the script. The source file is defined by the “path” parameter – the full path to the file on disk. The result of the function is the ID of the newly created file attachment. Supported output types are “doc”, “docx”, “htm”, “pdf”, “rtf”, “txt”, “xlsx”, “xml”.

Example:

OCR2FILE(#rootpath#Temp\source.xlsx, pdf)
 

int OCR2FILE(string path, string type, string url)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function OCR converts the text from the file specified by the “path” parameter, and creates a new file attachment defined by the “type” parameter. The conversion is always performed by the OCR server, including MS Word and Excel files; native conversion of these files is offered only by the OCR2TEXT and OCR2HTML functions. If the OCR server creates more files, the result is an attachment in ZIP format. The function is not executed in a test run of the script. The source file is defined by the “path” parameter – the full path to the file on disk. The result of the function is the ID of the newly created file attachment. Supported output types are “doc”, “docx”, “htm”, “pdf”, “rtf”, “txt”, “xlsx”, “xml”. The OCR recognition itself is performed by a separate web application at the address defined by the “url” parameter.

Example:

OCR2FILE(#rootpath#Temp\source.xlsx, xlsx, https://www.netgenium.com/netgenium_with_ocr)
 

int OCR2FILE(int file, string type)

Use: Script

Description: The function OCR converts the text from the file attachment specified by the “file” parameter, and creates a new file attachment defined by the “type” parameter. The conversion is always performed by the OCR server, including MS Word and Excel files; native conversion of these files is offered only by the OCR2TEXT and OCR2HTML functions. If the OCR server creates more files, the result is an attachment in ZIP format. The function is not executed in a test run of the script. The source file attachment is defined by the “file” parameter – the file attachment ID. The result of the function is the ID of the newly created file attachment. Supported output types are “doc”, “docx”, “htm”, “pdf”, “rtf”, “txt”, “xlsx”, “xml”.

Example:

OCR2FILE(#ng_attachment#, docx)
 

int OCR2FILE(int file, string type, string url)

Use: Script

Description: The function OCR converts the text from the file attachment specified by the “file” parameter, and creates a new file attachment defined by the “type” parameter. The conversion is always performed by the OCR server, including MS Word and Excel files; native conversion of these files is offered only by the OCR2TEXT and OCR2HTML functions. If the OCR server creates more files, the result is an attachment in ZIP format. The function is not executed in a test run of the script. The source file attachment is defined by the “file” parameter – the file attachment ID. The result of the function is the ID of the newly created file attachment. Supported output types are “doc”, “docx”, “htm”, “pdf”, “rtf”, “txt”, “xlsx”, “xml”. The OCR recognition itself is performed by a separate web application at the address defined by the “url” parameter.

Example:

OCR2FILE(#ng_attachment#, pdf, https://www.netgenium.com/netgenium_with_ocr)

Behavior common to all variants of the OCR2FILE function:

  • The output type can also be specified with a dot at the beginning (e.g. “.pdf”).
  • For the variants with the “path” parameter, the file path may be restricted to allowed directories depending on the environment of the instance; an attempt to access a path outside them then throws an exception.
  • If the source file does not exist, the function returns “0”.
  • If the conversion fails for a variant without the “url” parameter, the function returns an empty string.
  • If the conversion fails in the separate web application specified by the “url” parameter, the function throws an exception.
  • A filled-in “url” parameter that is not a full address with the “http” or “https” scheme throws the exception “OCR2FILE(...) ERROR Invalid URL”; an empty “url” parameter leaves the conversion to the OCR server.
  • In the NET Genium Online cloud edition, the function also rejects with this exception an address that leads to the server itself or to the internal network or whose name cannot be resolved; it does not follow redirects.
  • The OCR server always recognizes the text as Czech; the recognition language cannot be selected.

string OCR2HTML(string path)

Use: HTML, JavaScript, Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function converts the OCR text from the file specified by the “path” parameter, and returns it as a text string in HTML format. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file is defined by the “path” parameter – the full path to the file on disk.

Example:

OCR2HTML(#rootpath#Temp\source.xlsx)
 

string OCR2HTML(string path, string url)

Use: HTML, JavaScript, Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function converts the OCR text from the file specified by the “path” parameter, and returns it as a text string in HTML format. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file is defined by the “path” parameter – the full path to the file on disk. The OCR recognition itself is performed by a separate web application at the address defined by the “url” parameter.

Example:

OCR2HTML(#rootpath#Temp\source.xlsx, https://www.netgenium.com/netgenium_with_ocr)
 

string OCR2HTML(int file)

Use: HTML, JavaScript, Script

Description: The function converts the text from the file attachment specified by the “file” parameter by the OCR method, and returns it as a text string in HTML format. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file attachment is defined by the “file” parameter – the file attachment ID.

Example:

OCR2HTML(#ng_attachment#)
 

string OCR2HTML(int file, string url)

Use: HTML, JavaScript, Script

Description: The function converts the text from the file attachment specified by the “file” parameter by the OCR method, and returns it as a text string in HTML format. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file attachment is defined by the “file” parameter – the file attachment ID. The OCR recognition itself is performed by a separate web application at the address defined by the “url” parameter.

Example:

OCR2HTML(#ng_attachment#, https://www.netgenium.com/netgenium_with_ocr)

Behavior common to all variants of the OCR2HTML function:

  • For the variants with the “path” parameter, the file path may be restricted to allowed directories depending on the environment of the instance; an attempt to access a path outside them throws an exception in a script, elsewhere the function returns the error text instead of the result.
  • The “url” parameter is used as the address of a separate web application only if it starts with “http://” or “https://”; such an address that is not a valid full address throws the exception “OCR2HTML(...) ERROR Invalid URL” when the file is converted by the separate web application.
  • If the conversion fails in the separate web application, the function throws an exception.
  • In the NET Genium Online cloud edition, the function rejects an address of a separate web application that leads to the server itself or to the internal network or whose name cannot be resolved, and throws the exception “OCR2HTML(...) ERROR Invalid URL”; it does not follow redirects.
  • Variables written in the same text are not substituted at the level of the call or at the higher levels of the expression (only variables in parameters of other functions outside double quotation marks that do not contain a call of the function themselves are substituted) and stay in it in the notation “#...#”; the call of the function therefore belongs in a separate text, for example in its own script step.
  • When the OCR server converts the file, it always recognizes the text as Czech; the recognition language cannot be selected.
  • If no address of a separate web application is specified and the conversion through the OCR server fails, the function converts a PDF file directly to plain text; for other formats it returns an empty string.

string OCR2TEXT(string path)

Use: HTML, JavaScript, Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function converts the OCR text from the file specified by the “path” parameter, and returns it as a plain text string without HTML formatting. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file is defined by the “path” parameter – the full path to the file on disk.

Example:

OCR2TEXT(#rootpath#Temp\source.xlsx)
 

string OCR2TEXT(string path, string url)

Use: HTML, JavaScript, Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function converts the OCR text from the file specified by the “path” parameter, and returns it as a plain text string without HTML formatting. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file is defined by the “path” parameter – the full path to the file on disk. The OCR recognition itself is performed by a separate web application at the address defined by the “url” parameter.

Example:

OCR2TEXT(#rootpath#Temp\source.xlsx, https://www.netgenium.com/netgenium_with_ocr)
 

string OCR2TEXT(int file)

Use: HTML, JavaScript, Script

Description: The function OCR converts the text from the file attachment specified by the “file” parameter, and returns it as a plain text string without HTML formatting. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file attachment is defined by the “file” parameter – the file attachment ID.

Example:

OCR2TEXT(#ng_attachment#)
 

string OCR2TEXT(int file, string url)

Use: HTML, JavaScript, Script

Description: The function OCR converts the text from the file attachment specified by the “file” parameter, and returns it as a plain text string without HTML formatting. Conversion from MS Word or Excel files is performed natively, in other cases it uses an OCR server. The source file attachment is defined by the “file” parameter – the file attachment ID. The OCR recognition itself is performed by a separate web application at the address defined by the “url” parameter.

Example:

OCR2TEXT(#ng_attachment#, https://www.netgenium.com/netgenium_with_ocr)

Behavior common to all variants of the OCR2TEXT function:

  • For the variants with the “path” parameter, the file path may be restricted to allowed directories depending on the environment of the instance; an attempt to access a path outside them throws an exception in a script, elsewhere the function returns the error text instead of the result.
  • The “url” parameter is used as the address of a separate web application only if it starts with “http://” or “https://”; such an address that is not a valid full address throws the exception “OCR2TEXT(...) ERROR Invalid URL” when the file is converted by the separate web application.
  • If the conversion fails in the separate web application, the function throws an exception.
  • In the NET Genium Online cloud edition, the function rejects an address of a separate web application that leads to the server itself or to the internal network or whose name cannot be resolved, and throws the exception “OCR2TEXT(...) ERROR Invalid URL”; it does not follow redirects.
  • Variables written in the same text are not substituted at the level of the call or at the higher levels of the expression (only variables in parameters of other functions outside double quotation marks that do not contain a call of the function themselves are substituted) and stay in it in the notation “#...#”; the call of the function therefore belongs in a separate text, for example in its own script step.
  • When the OCR server converts the file, it always recognizes the text as Czech; the recognition language cannot be selected.
  • If no address of a separate web application is specified and the conversion through the OCR server fails, the function converts a PDF file directly to plain text; for other formats it returns an empty string.

string PADLEFT(string text, int totalwidth, string pad)

Use: HTML, JavaScript, Script

Description: The function fills the text string specified by the “text” parameter from the left with the character specified by the “pad” parameter to the length specified by the “totalwidth” parameter. The “pad” parameter must be exactly one character (a space has to be enclosed in double quotation marks), otherwise the call is not evaluated. A text that is as long as “totalwidth” or longer is returned unchanged.

Example:

PADLEFT(x, 5, 0)
// Returns “0000x”
 

string PADRIGHT(string text, int totalwidth, string pad)

Use: HTML, JavaScript, Script

Description: The function completes the string specified by the “text” parameter on the right with the character specified by the “pad” parameter to the length specified by the “totalwidth” parameter. The “pad” parameter must be exactly one character (a space has to be enclosed in double quotation marks), otherwise the call is not evaluated. A text that is as long as “totalwidth” or longer is returned unchanged.

Example:

PADRIGHT(x, 5, 0)
// Returns “x0000”
 

string PAGEIDENTIFIER(string page)

Use: HTML, JavaScript, Script

Description: The function converts the text specified by the “page” parameter (typically the name of a web page) to an identifier: it removes diacritics, converts letters to lower case and replaces every run of characters that are not a letter or digit with a single hyphen; it inserts no hyphen at the end of the identifier, and at the beginning only if the text starts with a character that is not a letter or digit. The function does not look up any web page.

Example:

PAGEIDENTIFIER(Calendar Action)
// Returns “calendar-action”
 

string PAGEIDENTIFIER2(string page)

Use: HTML, JavaScript, Script

Description: The function converts the text specified by the “page” parameter (typically the name of a web page) to an identifier: it removes diacritics, omits characters that are not a letter or digit and converts the first letter of every word to upper case; it leaves the other letters unchanged. The function does not look up any web page.

Example:

PAGEIDENTIFIER2(Calendar Action)
// Returns “CalendarAction”
 

double POWER(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the square of the number specified by the “number” parameter.

Example:

POWER(-1.23)
// Returns “1,5129”
POWER(5)
// Returns “25”
POWER(#A#)
 

int PRINTATTACHMENT(int button, int id)

Use: Script

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function starts the print defined on the control specified by the “button” parameter, saves the resulting print report as a new file attachment, and returns the ID of this attachment. The “button” parameter indicates the ID of the button that handles the printing, and the “id” parameter indicates the ID of the database record to be printed. The button must be a “Button” control of an edit form and the record must exist in the database, otherwise the function returns “0”. If the button has a script, the function executes it before printing and saves the record according to the settings of the button; the button script and the saving of the record are committed separately, so a later error of the calling script does not take them back. The script variables of the print template are taken from the button script; if the button has no script steps, they are taken from the calling script. If the button has no print template, only its script is executed and the function returns “0”. The function does not use the “Open a new email form” and “Open an edit form” options of the button; a checked “1 nested record = 1 sheet (XLS) / 1 document (DOC)” field keeps only one sheet in a Microsoft Excel template and prints a Microsoft Word template to a single document. In a test run of the script and in a script in which demo mode suppresses writes, the function returns “0” and does nothing.

Example:

PRINTATTACHMENT(123, 1)
 

void PRINTCOLUMNS(int[] cids)

Use: Note database query

Description: The function limits the list of loaded columns when printing to the print template. The columns to be loaded are defined as an array of identifiers, where the column ID is the same as the control ID by which the column is defined (eg TextBox ID). The function takes effect only for a row query without a limit on the number of loaded records; it has no effect for a statistical (aggregate) query, for a query with the “Load only first” field filled in and in an instance without a valid license key (except NET Genium Online). Besides the specified columns, the ID and the owner of the record (the “id” and “userid” columns) of the table of the query and of all joined tables are always loaded. The control IDs can be separated by a comma or a semicolon; a control that lies neither in the table of the query nor in any joined table is ignored.

Example:

PRINTCOLUMNS(1, 2, 3)
 

void PROTECTFORM(int form, int id, string message)

Use: Script (where a comment is expected)

Description: The function verifies whether the record specified by the “id” parameter is locked in the edit form specified by the “form” parameter. If so, it triggers the interrupt specified by the “message” parameter. The message can be entered in multiple languages. The text “Record ID {2} is locked by the user {0} until {1}.” is automatically appended to the “message” parameter, where {0} is the login name of the user who locked the record, {1} is the time until which the record is locked (including the date for a lock that does not end today) and {2} is the ID of the record. If the record is locked by the user who ran the script (for example in another window), the text “You have record ID {2} open in another window or browser, so it stays locked until {1}.” is appended instead. The function is not performed when the script is run in test mode. Calling the function only makes sense if the form is set to lock records. The function is evaluated before the script starts, together with the whole comment line on which it is written – it is therefore written on a separate comment line, otherwise the other functions on the same line would be performed twice.

Example:

PROTECTFORM(1, 1, Record editing not allowed.)
// Returns for example “Record editing not allowed. Record ID 1 is locked by the user Administrator until 12:30.”
 

void PROTECTSCRIPT(int form, int n, string message)

Use: Script (where a comment is expected)

Description: The function verifies that the script specified by the “form” and “n” parameters is running. If so, it triggers the interrupt specified by the “message” parameter. The message can be entered in multiple languages. The parameters “form” and “n” can be found in admin mode in the tooltip, which is displayed after hovering the mouse pointer over the link “Modify script”. A button script and the “OnBeforeSave” and “OnBeforeDelete” scripts are regarded as running. The function is evaluated before the script starts, together with the whole comment line on which it is written – it is therefore written on a separate comment line, otherwise the other functions on the same line would be performed twice.

Example:

PROTECTSCRIPT(1, 10, ABC script execution not allowed. Please wait for it to complete.)
 

string QRPAYMENTCODE(string account, string countrycode, double amount, string currency, string vs, string ss, string ks)

Use: HTML, JavaScript, Script

Description: The function generates a QR payment code string in the SPD (Short Payment Descriptor) standard for a bank transfer payment. It returns the text of the code, not an image. Parameters:

  • “account” – bank account number in IBAN format, or in the national format “prefix-number/bank code” (e.g. “19-2000145399/0800”) used in the Czech Republic and in Slovakia; an account of another country has to be specified as IBAN. A value that starts with two letters is used as IBAN without checking its validity.
  • “countrycode” – two-letter country code (e.g. “CZ”) used to convert an account number in the national format to IBAN; an empty value means “CZ” and a code that does not consist of two letters raises an error when an account number in the national format is converted
  • “amount” – amount; the code contains it with two decimal places
  • “currency” – currency code (e.g. “CZK”, “EUR”)
  • “vs” – variable symbol
  • “ss” – specific symbol
  • “ks” – constant symbol

An empty variable, specific and constant symbol are omitted from the resulting code. The function does not support a message for the recipient. For invalid input the function returns an empty string and writes the error to the “Warnings” log, so the document is printed without the QR code.

Details
  • An account number in the national format that, after removing spaces, contains characters other than digits, has a prefix longer than 6 digits, an account number after a hyphen longer than 10 digits, a bank code of a length other than 4 digits, a basic account number (the part after the prefix) with fewer than two non-zero digits or does not pass the checksum is rejected by the function, which returns an empty string. An account number without a hyphen with 11 to 16 digits is taken as a prefix joined with the account number – the last 10 digits are the account number and the remaining digits the prefix.
  • Only the digits of the variable, specific and constant symbol are used, so a symbol without digits is omitted just like an empty one. The currency code is converted to upper case. The function does not write a zero amount or an empty currency code into the code; it rejects a negative amount, an amount whose notation in the code exceeds 10 characters, a non-empty currency code that does not consist of three letters and a symbol longer than 10 digits, and returns an empty string.

Example:

QRPAYMENTCODE(CZ6508000000192000145399, CZ, 1500, CZK, 1234567890, , 0308)
// Returns “SPD*1.0*ACC:CZ6508000000192000145399*AM:1500.00*CC:CZK*X-VS:1234567890*X-KS:0308”
QRPAYMENTCODE(#ng_account#, CZ, #ng_amount#, CZK, #ng_vs#, , )
// Generates a QR payment code from the form field values
 

string READURL(string text)

Use: HTML, JavaScript, Script

Description: The function reads the content of the web page defined by the “text” parameter, and returns its content. The function reads only addresses with the “http” or “https” scheme; in the NET Genium Online cloud edition it also rejects addresses leading to the server itself and to the internal network as well as addresses whose name cannot be resolved, and does not follow redirects (it returns the content of the redirect response). A rejected address throws the exception “READURL(...) ERROR Invalid URL”, even in a test run of the script; in an HTML control this stops the loading of the page. If the page cannot be read (for example the server returns an error response or the address is unreachable), the function returns an empty string. The content of the page is read in the UTF-8 encoding.

Example:

READURL(https://www.netgenium.com)
 

void RECYCLEPOOL(string applicationpool)

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function recycles the application pool specified by the “applicationpool” parameter. The script that states the “RECYCLEPOOL” function must be run exclusively using the “RunScript.exe” program.

Example:

RECYCLEPOOL(DefaultAppPool)
 

void REDUCEATTACHMENT(int file, int quality)

Use: Script (where a comment is expected)

Description: The function changes the quality of the image specified by the “file” parameter to the value specified by the “quality” parameter (range 1–99) and saves the file in “jpg” format. If the file is in a different format (bmp, gif, jpe, jpeg, png), it is automatically converted to “jpg” and the record in the attachment database is updated accordingly. Files in non-image formats are ignored. A file with an image extension that cannot be loaded as an image remains unchanged. The “quality” parameter must be in the range 1–99; values 0 and 100 deactivate the function.

Example:

REDUCEATTACHMENT(#ng_image#, 25)
// Reduces the image quality to 25% and saves as JPG
REDUCEATTACHMENT(#ng_image#, 75)
// Reduces the image quality to 75% (compromise between quality and file size)
REDUCEATTACHMENT(#ng_png#, 90)
// PNG file will be converted to JPG with 90% quality
 

void REDUCEATTACHMENT(int file, int maxwidth, int maxheight)

Use: Script (where a comment is expected)

Description: The function resizes the image specified by the “file” parameter so that it does not exceed the maximum width “maxwidth” and height “maxheight” in pixels (preserving the aspect ratio), and saves it in “jpg” format. The highest possible quality will be used for resizing. If the image is resized according to the “maxwidth” or “maxheight” parameter with a value of exactly 120 and its aspect ratio is less than 1.5, a fast thumbnail is created instead. The function processes image formats only: bmp, gif, jpe, jpeg, jpg, png. Files in other formats are ignored. A file with an image extension that cannot be loaded as an image remains unchanged. If an image in a format other than jpg is resized, it is automatically converted and the record in the attachment database is updated accordingly. If the image does not exceed the specified dimensions, the file remains unchanged, including its format. A value of 0 in the “maxwidth” or “maxheight” parameter sets that dimension as unlimited.

Example:

REDUCEATTACHMENT(#ng_image#, 500, 500)
// Resizes the image so that it is at most 500×500 pixels (preserving the aspect ratio)
REDUCEATTACHMENT(#ng_photography#, 1920, 0)
// Limits the width to 1920 px, height is unlimited
 

void REDUCEATTACHMENT(int file, int maxwidth, int maxheight, bool highquality)

Use: Script (where a comment is expected)

Description: The function resizes the image specified by the “file” parameter so that it does not exceed the maximum width “maxwidth” and height “maxheight” in pixels (preserving the aspect ratio), and saves it in “jpg” format. The “highquality” parameter set to “true” indicates that the highest possible quality will be used for resizing. Otherwise, standard (faster but lower quality) interpolation will be used. If the image is resized according to the “maxwidth” or “maxheight” parameter with a value of exactly 120 and its aspect ratio is less than 1.5, a fast thumbnail is created instead. The function processes image formats only: bmp, gif, jpe, jpeg, jpg, png. A file with an image extension that cannot be loaded as an image remains unchanged. If the image does not exceed the specified dimensions, the file remains unchanged, including its format; the conversion to the “jpg” format takes place only when the image is resized.

Example:

REDUCEATTACHMENT(#ng_image#, 500, 500, true)
// Resizes the image to max. 500×500 px with the highest possible quality
REDUCEATTACHMENT(#ng_image#, 500, 500, false)
// Resizes the image to max. 500×500 px with standard (faster) quality
 

string REMOVEDIACRITICS(string text)

Use: HTML, JavaScript, Script

Description: The function removes diacritics from the text string specified by the “text” parameter.

Example:

REMOVEDIACRITICS(Příliš žluťoučký kůň pěl ďábelské ódy)
// Returns “Prilis zlutoucky kun pel dabelske ody”
 

string REMOVEIFCONTAINS(string text [, string search1, string search2, ...])

Use: HTML, JavaScript, Script

Description: The function resets the “text” parameter if it contains the substring “search1” or “search2” or “search3”, etc. Every text contains an empty substring, so with an empty searched substring the function always returns an empty string; if the searched substring is substituted from a variable that can be empty, the empty value has to be handled.

Example:

REMOVEIFCONTAINS(Invoice is registered, is)
// Returns “” (empty string)
 

string REMOVEIFENDSWITH(string text [, string search1, string search2, ...])

Use: HTML, JavaScript, Script

Description: The function resets the “text” parameter if it ends with the substring “search1” or “search2” or “search3”, etc. Every text ends with an empty substring, so with an empty searched substring the function always returns an empty string; if the searched substring is substituted from a variable that can be empty, the empty value has to be handled.

Example:

REMOVEIFENDSWITH(Good morning, morning, evening)
// Returns “” (empty string)
 

string REMOVEIFEQUALS(string text [, string search1, string search2, ...])

Use: HTML, JavaScript, Script

Description: The function resets the “text” parameter if it matches the substring “search1” or “search2” or “search3”, etc.

Example:

REMOVEIFEQUALS(Approved, Approved)
// Returns “” (empty string)
 

string REMOVEIFSTARTSWITH(string text [, string search1, string search2, ...])

Use: HTML, JavaScript, Script

Description: The function resets the “text” parameter if it starts with the substring “search1” or “search2” or “search3”, etc. Every text starts with an empty substring, so with an empty searched substring the function always returns an empty string; if the searched substring is substituted from a variable that can be empty, the empty value has to be handled.

Example:

REMOVEIFSTARTSWITH(Invoice is registered, Fact, Fakt, Faak)
// Returns “” (empty string)
 

string REMOVETAGS(string html)

Use: HTML, JavaScript, Script

Description: The function removes all tags from the string specified by the “html” parameter. Together with the “title”, “script” and “style” tags it also removes their content; HTML entities (for example “&lt;”) are left undecoded.

Example:

REMOVETAGS(<p>abc</p><p>abc</p>)
// Returns “abcabc”
 

string REMOVEWHITESPACES(string value)

Use: HTML, JavaScript, Script

Description: The function removes all white-space characters (spaces, tabs, line breaks and non-breaking spaces) from the string specified by the “value” parameter.

Example:

REMOVEWHITESPACES(a b c)
// Returns “abc”
 

void RENAMEATTACHMENT(int file, string name)

Use: Script (where a comment is expected)

Description: The function renames the file attachment specified by the “file” parameter to the name specified by the “name” parameter without the extension. If the “name” parameter contains the extension of the file as well, the extension is not doubled; text after the last dot that does not match the extension of the file remains part of the name. Characters that a file name must not contain (slash, backslash, colon, asterisk, question mark, double quotation mark, the less-than and greater-than signs and the vertical bar) are left out of the new name and a tab is replaced by a space; if nothing but the extension remains of the name, the attachment is not renamed.

Example:

RENAMEATTACHMENT(#ng_attachment#, New file name)
 

void RENAMEATTACHMENT(int file, string prefix, string postfix)

Use: Script (where a comment is expected)

Description: The function renames the file attachment specified by the “file” parameter to a new name, which is created by combining the value of the “prefix” parameter, the original file name without extension, the value of the “postfix” parameter, and then the extension. Characters that a file name must not contain (slash, backslash, colon, asterisk, question mark, double quotation mark, the less-than and greater-than signs and the vertical bar) are left out of the new name and a tab is replaced by a space; if nothing but the extension remains of the name, the attachment is not renamed.

Example:

RENAMEATTACHMENT(#ng_attachment#, A-, -B)
 

string REPLACE(string text, string oldvalue, string newvalue)

Use: HTML, JavaScript, Script

Description: The function returns the text string specified by the “text” parameter, in which all occurrences of the string stored in the “oldvalue” parameter were replaced by the string stored in the “newvalue” parameter. In JavaScript, a name written in lower case is not evaluated and is preserved for the browser.

Example:

REPLACE(Hello NET Genium, NET Genium, NG)
// Returns “Hello NG”
 

string REPLACEIFEQUALS(string compare1, string compare2, string text)

Use: HTML, JavaScript, Script

Description: The function returns the value of the “text” parameter if the value of the “compare1” parameter is equal to the value of the “compare2” parameter. Otherwise, it returns the value of the “compare1” parameter.

Example:

REPLACEIFEQUALS(abc, abc, def)
// Returns “def”
 

string REPLACETAB(string items, string olditem, string newitem)

Use: HTML, JavaScript, Script

Description: The function returns a tab-delimited list of items specified by the “items” parameter, in which all items equal to the “olditem” (pattern) parameter have been replaced by the value specified by the “newitem” (replacement) parameter.

Example:

REPLACETAB(abc#tab#abcd#tab#def, abc, def)
// Returns “def#tab#abcd#tab#def”
 

string REPLYBODY(string from, string to, DateTime date, string body)

Use: HTML, JavaScript, Script

Description: The function returns the value of the “body” parameter as a formatted email response. The body of the sent e-mail message starts with a free line where the text can be written in response to the received e-mail. The next line shows the current response time defined by the “date” parameter, always written in the English format (e.g. “Tuesday, February 29, 2000 12:34 PM”), and a link to the e-mail address stored in the “from” parameter; the text of the link is the name of the sender if the address contains it, otherwise the address itself. This parameter represents the e-mail address of the sender of the original message. On the next lines there is the text of the original message (the “body” parameter) bordered on the left by a vertical line. If the “body” parameter contains neither the “<” nor the “>” character, the function replaces the CR LF line breaks in it with HTML line breaks; otherwise it inserts it unchanged as HTML code. In both cases, the function removes the white space characters (spaces, tabs and line breaks) at the beginning and at the end of the “body” parameter. An invalid date in the “date” parameter is output as “Monday, January 1, 0001 12:00 AM”. The “to” parameter is the email address of the recipient of the original message and the “REPLYBODY” function does not currently work with it.

Example:

REPLYBODY(info@netgenium.com, info@netgenium.com, #now#, body)
 

string REQUESTFORM(string name)

Use: HTML, JavaScript, Script

Description: The function returns the value of the form element specified by the “name” parameter when executing the HTML postback. Potentially dangerous HTML tags and leading and trailing spaces are removed from the returned value. The value is supplied by the web browser and the function does not encode it otherwise; it is therefore inserted into HTML through the “HTMLENCODE” function.

Example:

<input name="C5$tb" type="text" value="New Invoice" id="C5_tb" style="width:110px;">
REQUESTFORM(C5$tb)
// Returns “New Invoice”
 

string REQUESTFORMVALUES(string control)

Use: HTML, JavaScript, Script

Description: The function returns all fields submitted from the form in the current postback, each on a separate line in the form “name: value”. The function does not use the “control” parameter, but it must be specified. The values are not encoded; the result is intended mainly for debugging and is not to be output to HTML.

Example:

REQUESTFORMVALUES(1)
// Returns e.g.
// ng-pk: 4f1c...
// C5$tb: New invoice
 

string REQUESTQUERYSTRING(string attribute)

Use: HTML, JavaScript, Script

Description: The function returns the value of the attribute from the current URL. The attribute name is specified by the “attribute” parameter. The returned value is HTML-encoded (e.g. the “<” character is returned as “&lt;”); the original form is returned by the “HTMLDECODE” function.

Example:

https://www.netgenium.com?id=123&next=true
REQUESTQUERYSTRING(id)
// Returns “123”
 

void RESETDATAGRIDSETTINGS(int query)

Use: Script (where a comment is expected)

Description: The function resets the datagrid setting specified by the “query” parameter for the currently logged in user by clearing the search term, unchecking the search in each column, setting the value of all filters to “(All)” and also removing the custom conditions that the user set for the datagrid. For the anonymous user the column filters, the search selection in individual columns and the conditions of the composed filter are cleared on its account, which all anonymous visitors share.

Example:

RESETDATAGRIDSETTINGS(123)
 

void RESETUSERPASSWORD(string ng_checkbox, string from, string subject, string message)

Use: Script (where a comment is expected)

Description: The function sets a new temporary password for all users who have the check box specified by the “ng_checkbox” parameter checked and an e-mail address filled in, and clears the check box. Instead of the check box identifier, user IDs separated by a semicolon can be specified (typically the marked rows of a view table). The function never changes the built-in accounts with ID 1 and 2. The user receives the temporary password by e-mail from the address specified by the “from” parameter, with the subject specified by the “subject” parameter and the text specified by the “message” parameter, followed by the login name and the password. If a password strength is set in the NET Genium settings, the temporary password must first be used to log in within one day; the first login with the temporary password ends this period and the password remains valid until the user changes it, and the user is prompted to change the password at every login with a login name and password; without a password strength the temporary password remains valid and the user is not prompted to change it. The function can also be run by a scheduled task.

  • User IDs can be separated by a semicolon or a tab. A user with an invalid e-mail address is skipped.
  • The new password is saved and the e-mail is sent immediately for each user separately, outside the transaction of the script, so a later error of the script does not take them back.
  • The subject and the text of the message can be multilingual; they are translated into the language of the recipient.
  • If the parameter is the list of marked rows of a view table, only the rows of the users to whom no password was sent remain marked after the function is executed.

Example:

RESETUSERPASSWORD(ng_marktosendpassword, #ng_sender#, #ng_subject#, #ng_message#)
RESETUSERPASSWORD(ng_ marktosendpassword, noreply@netgenium.com, Password expiration, Please change your password.)

Example email:

Please change your password.

Login name: novak.petr
Password: kR2FP50h
 

string RESOURCE(int index)

Use: HTML, JavaScript, Script

Description: The function returns an item from the list of resources with the specified number, i.e. the “index” parameter. The resources are defined in the “Resources.txt” file in the “NETGenium\Config\Resources\language_settings” directory according to the language of the logged-in user; if there is no file for this language, the file from the “en” directory is used. Each line of the file has the form “number=value”, where the number is the number of the item; the value can be enclosed in straight double quotation marks, which are removed. If the file does not contain an item with the specified number, the function returns the text “number_NOT_TRANSLATED”. A change of the “Resources.txt” file does not take effect immediately: the file is reloaded at the earliest after an hour, so the change may take effect with a delay of up to about two hours; it takes effect immediately after the application is restarted.

Example file content:

0="10 minutes"
1="10 seconds"
2="1 decimal place"

Example:

RESOURCE(2)
 

void RESTARTSERVICE(string service)

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function restarts the service specified by the “service” parameter. The script that states the “RESTARTSERVICE” function must be run exclusively using the “RunScript.exe” program.

Details
  • The function waits at most 150 seconds for the service to stop and only then starts it; a NET Genium Windows service waits up to 2 minutes for a running iteration when it is stopping. If the service does not stop within this limit, the start fails and the error is written only to the “Errors” log.

Example:

RESTARTSERVICE(CRMService)
 

void RESTOREFROMHISTORY(int form, int id)

Use: Script (where a comment is expected)

Description: The function restores the deleted record from the history specified by the “id” parameter in the edit form specified by the “form” parameter (form ID). The “id” parameter is the ID of the record in the history table, not the original ID of the deleted record; several IDs separated by a semicolon can also be specified. The record is restored under its original ID. A history row that does not mark a deletion, a record already restored once, or a record whose ID already exists in the database table, is skipped. Each restoration is written to the database immediately and outside the transaction of the script, so a later error of the script does not take it back. The save scripts of the form are not run during the restoration. The restored record is not added to the synchronization queue, so it is not transferred to the synchronized instances.

Example:

A = StringArray(SQL("SELECT id FROM ng_form_history WHERE deleted = 'x' AND date >= FORMATDATESQL(#today#)",;))
Cycle: For each A
RESTOREFROMHISTORY(123, #A#)
Next...
 

double ROUND(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the rounded value from the value specified by the “number” parameter. A half is rounded away from zero (“ROUND(2.5)” returns “3”, “ROUND(-2.5)” returns “-3”). For a number whose absolute value exceeds approximately 7.9 × 1028, the function ends with an error. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

ROUND(-1.63)
// Returns “-2”
ROUND(1.63)
// Returns “2”
 

double ROUND(double number, int decimals)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable; the parameters are separated by a semicolon in it: “ROUND(#A#; 2)”)

Description: The function returns the rounded value from the value specified by the “number” parameter, to the number of decimal places specified by the “decimals” parameter. A half is rounded away from zero and a negative “decimals” parameter rounds to tens, hundreds etc. (“ROUND(1250, -2)” returns “1300”). For a “decimals” parameter outside the range -28 to 28 and for a number whose absolute value exceeds approximately 7.9 × 1028 before or after shifting by the specified number of decimal places, the function ends with an error. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

ROUND(-1.636, 2)
// Returns “-1,64”
ROUND(1.636, 2)
// Returns “1,64”
 

void SAVEDATAGRIDSETTINGS(int query, int form, int id)

Use: Script (where a comment is expected)

Description: The function saves the current data grid settings (filters, search, conditions) for the query specified by the “query” parameter of the logged-in user into the record specified by the “form” (form ID) and “id” (record ID) parameters. The saved settings can later be restored using the LOADDATAGRIDSETTINGS function. The function writes into the tables of the optional “DataGrid Settings” application, which has to be imported into NET Genium, see the NET Genium settings guide. The settings are written immediately, outside the script transaction.

Example:

SAVEDATAGRIDSETTINGS(#lastqueryid#, #pform#, #pid#)
// Saves the current filter settings for the current record
 

string SCALEIMAGES(string html, int maxWidth, int maxHeight)

Use: HTML, JavaScript, Script

Description: The function returns the HTML code specified by the “html” parameter with modified dimensions of images. For images that have both the “width” and “height” attributes filled in, and for images inserted directly as data (“data:...;base64,...”) without these attributes, the “width” and “height” attributes will be set proportionally depending on the “maxWidth” and “maxHeight” parameters. For other images without the “width” and “height” attributes, the function sets the “max-width” and “max-height” style according to the “maxWidth” and “maxHeight” parameters; images with only one of the two attributes filled in stay unchanged. The value “0” means that the dimension is not limited.

Example:

SCALEIMAGES(#ng_html#, 20, 15)
 

string SEARCHFILES(string subject, string content, int results)

Use: HTML, JavaScript, Script

Description: The function searches for file attachments according to the specified criteria, and returns a table with three columns, where the first column contains the name of the file attachment, the second its size, and the third column the creation date. File attachments are searched in full text according to their name defined by the “subject” parameter and according to the content defined by the “content” parameter. The “results” parameter determines how many occurrences of file attachments found should be displayed in the table. Using the “content” parameter only makes sense if the file attachments are indexed by the Indexing Service or Windows Search.

Example:

SEARCHFILES(NETGenium.gif" 100)
SEARCHFILES(Name, Content, 100)
 

string SEARCHFILES(string subject, string content, int results, DateTime date1)

Use: HTML, JavaScript, Script

Description: The function searches for file attachments according to the specified criteria and returns a table with three columns, where the first column contains the name of the file attachment, the second its size, and the third column the creation date. File attachments are searched in full text according to their name defined by the “subject” parameter and according to the content defined by the “content” parameter. The “results” parameter determines how many occurrences of file attachments found should be displayed in the table. The “date1” parameter limits the search in the index to attachments with a creation date greater than or equal to the specified date; attachments found by name (“subject”) are added to the result regardless of the date. Using the “content” and “date1” parameters only makes sense if the file attachments are indexed by the Indexing Service or Windows Search.

Example:

SEARCHFILES(NETGenium.gif" 100, 1.1.2013)
// Returns attachments whose name contains “NETGenium.gif” and in addition attachments from the index created from 1.1.2013
SEARCHFILES(Name, Content, 100, 1.1.2013)
 

string SEARCHFILES(string subject, string content, int results, DateTime date1, DateTime date2)

Use: HTML, JavaScript, Script

Description: The function searches for file attachments according to the specified criteria and returns a table with three columns, where the first column contains the name of the file attachment, the second its size, and the third column the creation date. File attachments are searched in full text according to their name defined by the “subject” parameter and according to the content defined by the “content” parameter. The “results” parameter determines how many occurrences of file attachments found should be displayed in the table. The “date1” and “date2” parameters limit the search in the index to attachments with a creation date between these two specified dates inclusive; attachments found by name (“subject”) are added to the result regardless of the date. Using the “content”, “date1”, and “date2” parameters only makes sense if the file attachments are indexed by the Indexing Service or Windows Search.

Example:

SEARCHFILES(NETGenium.gif" 100, 1.1.2013, 31.12.2013)
// Returns attachments whose name contains “NETGenium.gif” and in addition attachments from the index created from 1.1.2013 to 31.12.2013
SEARCHFILES(Name, Content, 100, 1.1.2013, 31.12.2013)

Behavior common to all variants of the SEARCHFILES function:

  • The result includes file attachments of the whole instance regardless of the rights to the records they belong to, and the links in the table allow anyone who sees the HTML control to download them.
  • The name is searched as a substring of the file name; the results of the search by name and of the search in the index (by content and creation date) are added together.
  • The “results” parameter limits the number of selected file attachments without a defined order. Attachments whose file is missing on the disk are left out of the result, so the table may contain fewer rows. The creation date is the creation date of the file on the server disk.

string SEARCHNEXTID(string array, string id)

Use: HTML, JavaScript, Script

Description: The function accepts an array of values separated by a semicolon, which is specified by the “array” parameter. The value specified by the “id” parameter is searched for in this field, and the function then returns the value that is immediately after this value in the specified field. If the entered value “id” is not found in the field “array” or there is no value after the entered value in the field, the function returns “0”. If the value “id” is “0”, the function returns the first value of the specified field.

Example:

SEARCHNEXTID(1;2;3, 2)
// Returns “3”
SEARCHNEXTID(1;2;3, 0)
// Returns “1”
SEARCHNEXTID(two;four;six, four)
// Returns “six”
 

string SEARCHPREVID(string array, string id)

Use: HTML, JavaScript, Script

Description: The function accepts an array of values separated by a semicolon, which is specified by the “array” parameter. The value specified by the “id” parameter is searched for in this field, and the function then returns the value that is immediately before this value in the specified field. If the entered value “id” is not found in the “array” field or there is no value in the field before the entered value, the function returns “0”. If the value “id” is “0”, the function returns the last value of the specified field.

Example:

SEARCHPREVID(1;2;3, 2)
// Returns “1”
SEARCHPREVID(1;2;3, 0)
// Returns “3”
SEARCHPREVID(two;four;six, four)
// Returns “two”
 

string SECONDS2TIME(double seconds)

Use: HTML, JavaScript, Script

Description: The function returns a text string in the format “HH:mm:ss” expressed from the number of seconds specified by the “seconds” parameter. The number of hours does not wrap after 24 hours (90,000 seconds returns “25:00:00”) and a negative number of seconds returns a time with a minus sign. The function appends the fractional part of the seconds after a point, at most three digits (SECONDS2TIME(1.5) returns “00:00:01.5”).

Example:

SECONDS2TIME(480)
// Returns “00:08:00”
SECONDS2TIME(0)
// Returns “00:00:00”
 

void SENDCHATMESSAGE(string message)

Use: Script (where a comment is expected)

Description: The function sends a chat message, the text of which is defined by the “message” parameter. The message is sent to all sessions with an interactive login in a browser except the sessions of the user under whom the script runs, including sessions in which the user has not worked for a longer time; logins by a token, through web services or through Windows from an address with the “autologin” parameter do not receive the message. This message is not sent as a notification to mobile phones. The message is written immediately, outside the script transaction, so a later error of the script does not take it back.

Example:

SENDCHATMESSAGE(Hello)
 

void SENDCHATMESSAGE(string message, string loginname)

Use: Script (where a comment is expected)

Description: The function sends a chat message, the text of which is defined by the “message” parameter. The message is sent to the user specified by the “loginname” parameter. The user does not have to be currently logged in, the chat message will then be displayed after his next login. The message is written immediately, outside the script transaction, so a later error of the script does not take it back.

If the user has turned on notifications on a mobile phone or on a computer, a message left unread for 30 seconds also arrives as a system notification with at most the first 300 characters of the message text – even on the lock screen. Messages with sensitive data (salaries, absence, health) should therefore be worded generally, for example “You have a new request to approve”. A detailed description of notifications is provided in the separate guide [[chat-and-notifications#notifications Chat and notifications]].

Example:

SENDCHATMESSAGE(Hello, Administrator)
 

string SENDMAILINVITATION(string from, string replyto, string to, string cc, string bcc, string subject, string body, string attachments, bool save, string summary, string location, DateTime start, DateTime end, string description [, string c0, string v0 [, string c1, string v1...]])

Use: Script

Description: The function sends the meeting request via the e-mail address specified by the “from” parameter to the e-mail address specified by the “to” parameter, and returns the UID of the invitation. The “replyto” parameter indicates to which e-mail address this invitation should be replied to by default. The “summary” parameter defines the subject of the meeting, the “location” parameter defines the place of the meeting. The “start” and “end” parameters indicate the start and end of the meeting. The “description” parameter offers the option of entering a more detailed and multi-line description of the meeting; it is written only into the calendar part of the invitation. Other parameters are explained for the “SCHEDULEMAILMESSAGE” function.

  • The subject of the message starts with the word “Invitation:” in the language of the logged-in user, followed by the value of the “subject” parameter.
  • The body of the e-mail consists of an overview of the meeting (subject, date and time, place and attendees), followed by the text of the “body” parameter. The attendees are the organizer (the address from the “from” parameter, or the logged-in user if it is empty) and the recipients from the “to” and “cc” parameters; recipients of the blind copy (“bcc”) are not listed among the attendees, neither in the overview nor in the calendar part of the invitation.
  • If the “start” parameter is not a valid date, the current time is used; if the “end” parameter is not a valid date, the meeting ends one hour after its start.
  • Empty “to”, “cc” and “bcc” parameters and invalid recipient addresses are handled in the same way as with the “SENDMAILMESSAGE” function.
  • The invitation is sent immediately, so a later error of the script does not take it back, and the function does not report an error when sending, in the same way as the “SENDMAILMESSAGE” function.

Example:

SENDMAILINVITATION(info@mojefirma.cz" info@netgenium.com" , E-mail message, Dear Sir..., 0, True, Meeting date, Venue, 25.4.2013 15:00, 25.4.2013 20:00, Meeting description)
 

string SENDMAILINVITATION2(string uid, string from, string replyto, string to, string cc, string bcc, string subject, string body, string attachments, bool save, string summary, string location, DateTime start, DateTime end, string description [, string c0, string v0 [, string c1, string v1...]])

Use: Script

The function is identical to the SENDMAILINVITATION function, but its first parameter “uid” accepts the UID of the invitation. An invitation with the same UID updates the meeting that the recipient already has in the calendar; an empty “uid” parameter generates a new UID. The function returns the UID used, which is worth saving with the record for later changes of the meeting. The message is sent in the same way as by the SENDMAILINVITATION function, i.e. via SMTP server 1 and, if it fails, via SMTP server 2.

Example:

SENDMAILINVITATION2(#ng_uid#, info@mojefirma.cz, , info@netgenium.com, , , E-mail message, Dear Sir..., 0, True, Meeting subject,
Venue, 25.4.2013 15:00, 25.4.2013 20:00, Meeting description)
 

void SENDMAILMESSAGE(string from, string replyto, string to, string cc, string bcc, string subject, string body, string attachments, bool save [, string c0, string v0 [, string c1, string v1...]])

Use: Script (where a comment is expected)

Description: The function sends an e-mail message from the e-mail address specified by the “from” parameter to the e-mail address specified by the “to” parameter. The “replyto” parameter indicates which e-mail address should be replied to by e-mail by default. Other parameters are explained for the “SCHEDULEMAILMESSAGE” function.

If the “from” parameter is empty, the e-mail address and the name of the logged-in user are used. If the sender address is from a different domain than the default sender in the NET Genium settings, the message is sent from the default sender (in the NET Genium Online cloud edition always, regardless of the domain); if the “replyto” parameter is empty, the address from the “from” parameter is used as the reply address. A detailed description of the default sender is provided in the separate guide [[netgenium-settings NET Genium settings]]. If the subject starts with an exclamation mark followed by a character other than another exclamation mark, the exclamation mark is removed from the subject and the message requests a read receipt to the reply-to address or, if none is set, to the sender address. The message is sent immediately, so a later error of the script does not take it back. The function does not report an error when sending – if the message cannot be sent, it is saved into the “SMTP” directory. If the “save” parameter equals “True”, the message is stored in the sent mail table only when it was sent successfully. If none of the “to”, “cc” and “bcc” parameters is filled in, the message is sent to the service e-mail address from the NET Genium settings and “NG NO-RCPT:” is inserted into the subject; invalid recipient addresses are omitted. If all specified recipient addresses are invalid, the message is not redirected to the service e-mail address and it is not sent later from the “SMTP” directory either. The body of the message is sent in the uniform format of NET Genium e-mails (Arial font, 10 points); if the body begins exactly with “<!DOCTYPE”, “<html” or “<HTML” (a whole HTML document, typically a newsletter), it is sent unchanged.

Example:

SENDMAILMESSAGE(info@mojefirma.cz, , info@netgenium.com, , , E-mail message, Dear Sir..., 0, True)
SENDMAILMESSAGE(info@mojefirma.com, , info@netgenium.com, , , E-mail message, Dear Sir..., 1;#ng_attachment#, true)
 

void SENDMAILMESSAGE2(string from, string replyto, string to, string cc, string bcc, string subject, string body, string attachments, bool save [, string c0, string v0 [, string c1, string v1...]])

Use: Script (where a comment is expected)

The function is identical to the SENDMAILMESSAGE function, but uses a second SMTP server – in the NET Genium settings “SMTP Server 2”. If it fails, the message is not sent through SMTP server 1; it is saved into the “SMTP” directory, from which the “ResendEmlFiles.exe” program tries to send it first through SMTP server 1.

string SERIALIZEFORMDATA()

Use: Script

Description: The function serializes the current form data into an XML format string. The resulting XML string contains the values of all form fields at the time the function is called and can be stored in a database, transferred to another server, or processed by other functions.

Example:

A = SERIALIZEFORMDATA()
 

void SETCOOKIE(string key, string value, DateTime expires)

Use: Script (where a comment is expected)

Description: The function sets the cookie value specified by the “key” parameter to the value defined by the “value” parameter, with the expiration date defined by the “expires” parameter. The “SameSite” parameter will be set to “Strict”, the “Secure” parameter will be selected according to the NET Genium configuration (configuration file “SecureCookies.txt”, “SSL.txt”, or secure communication via the “https” protocol), and the “HttpOnly” will be set to “False”. The cookie is set only if the “expires” parameter contains a valid date. Unlike other functions with a side effect, the function is executed even in a test run of the script.

Example:

SETCOOKIE(abc, def, #today# + 6m)
 

void SETCONTROLNAME(int id, string name)

Use: Script (where a comment is expected)

Description: The function temporarily changes the heading of a view table (DataGrid, LiteDataGrid) or a chart (Chart) identified by the “id” parameter (the control's database ID) so that it is displayed under the name specified by the “name” parameter during the current rendering. It works on a view page as well as in an edit form. On a view page it also changes the heading of the “History”, “DataSet” and “Email” controls in the same way; it does not change the names of other controls. The “name” parameter may contain a multilingual term (translated according to the logged-in user's language). The change is only valid for the duration of the current request — the control's label in the database is not changed. Combined with the SETQUERYCOLUMN function, it allows the datagrid or chart title to be changed dynamically according to the selected aggregation column, so there is no need to create duplicate view pages differing only in the title or the aggregated column.

Example:

SETCONTROLNAME(456, Customer orders)
// View table ID 456 in the edit form will be displayed under the heading “Customer orders”
SETCONTROLNAME(551, Total CZK)
// Datagrid or chart ID 551 will be displayed under the heading “Total CZK”
 

void SETDATAGRIDSELECTION(string control, string ids)

Use: Script (where a comment is expected)

Description: The function sets in the datagrid specified by the “control” parameter a list of primary keys of all selected records separated by semicolons specified by the “ids” parameter. The “control” parameter indicates the name of the control element according to the conventions used in variables or print templates:

  • datagridX
  • DGX

The “control” parameter can also be the ID of the database query of the datagrid; the first datagrid with this query is used.

Example:

SETDATAGRIDSELECTION(datagrid1, 1;2;3)
SETDATAGRIDSELECTION(DG123, 1;2;3)
 

void SETQUERYCOLUMN(int query, string columns, string name, int columnId, string dateType)

Use: Script (where a comment is expected)

Description: The function temporarily changes the configuration of one or more output columns of the statistical (aggregation) database query specified by the “query” parameter (query ID) for the current request. It is used to dynamically switch the column by which a datagrid or chart aggregates (or which it displays), so there is no need to create duplicate view pages differing only in the aggregated column. The “columns” parameter contains zero-based output-column indexes separated by semicolons (the first output column has index 0); the same change is applied to all listed columns. The “name” parameter changes the displayed column name when it is not empty; an empty string “” leaves the name unchanged. The name may contain a multilingual term. For a column whose definition has the form “name@expression@...”, the “name” parameter replaces only the part before the first “@” character and keeps the expression, accumulation, filter and sorting of the column; if “name” itself contains the “@” character, it replaces the whole column definition. The optional “columnId” parameter (the ID of another control) replaces the source column — it takes effect only when non-zero and when the new control belongs to the same form as the original column; the value 0 leaves the source column unchanged. The optional “dateType” parameter changes the time aggregation of a date key column to “day”, “week”, “month”, “quarter”, or “year” (it applies only to a column already grouped by day, week, month, quarter or year; a column grouped by hours is not changed by the parameter). The function must run before the query is rendered or evaluated; the change is not saved to the query definition.

Example:

SETQUERYCOLUMN(491, 1, Date)
// Sets the name of the column with index 1 (the second output column) of query ID 491 to “Date”

SETQUERYCOLUMN(491, 1, Date, 1220)
// Additionally replaces the source column with control ID 1220 (must be from the same form)

SETQUERYCOLUMN(491, 1;2;3;4;5, "", 1220)
// Leaves the names of columns 1 to 5 unchanged but replaces their source column with control ID 1220

SETQUERYCOLUMN(491, 1, "", 0, month)
// Leaves the name and source column unchanged, only changes the time aggregation to monthly

SETQUERYCOLUMN(491, 1, Day, 1220, day)
// Sets the name to “Day”, replaces the source column with control ID 1220, and changes the aggregation to daily
 

void SETVARIABLE(string variable, string value)

Use: Script (where a comment is expected)

Description: The function sets the value of the variable specified by the “variable” parameter to the value defined by the “value” parameter. The variable is specified by its name in upper case without parentheses (for example “A” or “AB”); with any other notation of the name the function does nothing. The variable must be declared beforehand, otherwise the script ends with an error; the exception is a value written directly in the call in the form “String(...)”, “Integer(...)”, “Long(...)”, “Double(...)” or “Date(...)”, which also declares the variable with this data type (for example “SETVARIABLE(A, String(abc))”), or in the form “StringArray(...)”, “IntegerArray(...)”, “LongArray(...)”, “DoubleArray(...)”, “DateArray(...)” or “EmailArray(...)”, which turns the variable into an array of values (for example “SETVARIABLE(A, StringArray(a;b;c))”; the array notations are described in the guide [[working-with-variables-in-scripts Working with variables in scripts]]). Such notation is not recognized in a value substituted from a control or variable. The value is converted according to the data type of the variable in the same way as when a value is assigned in a script – for a numeric variable the value is evaluated as an arithmetic expression (for example “1+2” gives 3), the text after the expression is discarded and an empty value gives zero; a value that cannot be evaluated as a number, an integer outside the range of the data type and an unrecognized date end the script with an error.

Example:

SETVARIABLE(A, abc)
 

void SCHEDULEBACK()

Use: Script (where a comment is expected)

Description: The function schedules the opening of the previous page immediately after the successful execution of the script. The function is performed only in these edit form scripts: in the scripts of buttons of the “Script” type and of buttons from the “Button” tab of database controls, in the “OnBeforeSave” and “OnAfterSave” scripts after saving with the “Save”, “Save and new”, “Save and continue editing” or “Synchronize” button, in the “OnBeforeDelete” and “OnAfterDelete” scripts after the record has been deleted and in the “OnAfterOpen” script in user mode. It is not performed in other scripts.

Example:

SCHEDULEBACK()
 

void SCHEDULEBACK(string message)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the previous page immediately after the successful execution of the script. After opening the previous page, the user is presented with a message in the dialog box specified by the “message” parameter. The text of the message can be entered in multiple languages.

Example:

SCHEDULEBACK(abc)
SCHEDULEBACK("Message that contains a comma.")
 

void SCHEDULEBACK(string message, bool dialog)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the previous page immediately after the successful execution of the script. After opening the previous page, the user is shown the message specified by the “message” parameter either in the dialog box or only as red highlighted text displayed at the bottom of the page. The text of the message can be entered in multiple languages.

Example:

SCHEDULEBACK(abc, false)
SCHEDULEBACK("Message that contains a comma.", false)
 

void SCHEDULEDEFAULTVALUE(string dbname, string value)

Use: Script (where a comment is expected)

Description: The function schedules the filling of the value specified by the “value” parameter into the control defined by the identifier “dbname” when opening the edit form immediately after the successful execution of the script. If the “dbname” parameter is “pid” or “pform”, the function does not fill in a control but sets the parent record (“pid”) or the edit form of the parent record (“pform”) of the new record that opens after the script – typically through the “SCHEDULEFORM” function or a button of the “Open an edit form” type. In the “OnBeforeOpen” script the parent record cannot be set this way – the new record opened by the “Save and new” button takes over the parent record of the record that has just been saved.

Example:

SCHEDULEDEFAULTVALUE(ng_status, Completed)
 

void SCHEDULEDEFAULTVALUE(string dbname, string dbtype, string value)

Use: Script (where a comment is expected)

Description: The function schedules the filling of the value specified by the “value” parameter into the control defined by the identifier “dbname” when opening the edit form immediately after the successful execution of the script. The “dbtype” parameter specifies the database type of the value specified by the “value” parameter. The “dbtype” parameter must contain exactly one of the values “String”, “Integer”, “Long”, “Double” or “Date”; with an empty or other type the function does not fill in the control. For a text value the variant without the “dbtype” parameter, which uses the database type “String”, is sufficient. If the “dbname” parameter is “pid” or “pform”, the function does not fill in a control but sets the parent record (“pid”) or the edit form of the parent record (“pform”) of the new record that opens after the script. In the “OnBeforeOpen” script the parent record cannot be set this way – the new record opened by the “Save and new” button takes over the parent record of the record that has just been saved.

Example:

SCHEDULEDEFAULTVALUE(ng_date, Date, #today# - 20)
 

void SCHEDULEDEFAULTVALUES(string dbname1, string dbname2, ... , string values)

Use: Script (where a comment is expected)

Description: The function schedules the completion of semicolon-separated values specified by the “values” parameter into the controls specified by the identifiers “dbname1”, “dbname2”, etc. open when the edit form is opened immediately after the successful execution of the script. If an identifier is “pid” or “pform”, the corresponding value sets the parent record or the edit form of the parent record of the new record, in the same way as for the “SCHEDULEDEFAULTVALUE” function. If the number of values does not match the number of identifiers, the script ends with the error “The number of values (...) does not match the number of columns (...).”.

Example:

SCHEDULEDEFAULTVALUES(ng_text1, ng_text2, #A#)
SCHEDULEDEFAULTVALUES(ng_text1, ng_text2, value1;value2)
 

void SCHEDULEENTRY(int id)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the record with the primary key specified by the “id” parameter in the currently open edit form immediately after the successful execution of the script. If the “id” parameter contains several values separated by a semicolon (for example a variable loaded from a database query), the first of them is used.

Example:

SCHEDULEENTRY(123)
 

void SCHEDULEENTRY(string column, int id)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the searched record in the currently open edit form immediately after the successful execution of the script. The record is retrieved in the associated database table from all records that have the value specified by the “id” parameter stored in the column specified by the “column” parameter. If more records match the condition, one of them is opened, in no defined order. If no record matching this condition is found, the value “id” is written into the “column” column of the currently open record and the record is saved after the successful execution of the script – typically a new record opened in the “OnAfterOpen” script. The “column” parameter can be “pid” or the identifier of a control starting with “ng_”; “pid” and the “ng_” prefix must be written in lower case. The function ignores any other notation, a column that does not exist and an error of the query without any message – it schedules nothing and writes nothing. If the “id” parameter contains several values separated by a semicolon (for example a variable loaded from a database query), the first of them is used.

Example:

SCHEDULEENTRY(pid, 123)
 

void SCHEDULEFORM(int id)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the edit form specified by the “id” parameter. The “id” parameter can be found in admin mode in the tooltip, which is displayed after hovering the mouse pointer over the “Modify edit form” link. An empty edit form will open to create a new record. If the function is called from a script of an edit form, the new record is created as a nested record of the currently open record and the user returns to the form after leaving it; another parent record can be set by the “SCHEDULEDEFAULTVALUE” function with the “pid” and “pform” identifiers. In the “OnBeforeDelete” and “OnAfterDelete” scripts, after the record has been deleted, the parent of the new record is the parent record of the deleted record, and after leaving the new record the user returns where they would have returned from the deleted record.

Example:

SCHEDULEFORM(1)
SCHEDULEFORM(#form#)
 

void SCHEDULEFORM(string dbname)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the edit form specified by the “dbname” parameter. An empty edit form will open to create a new record. If the function is called from a script of an edit form, the new record is created as a nested record of the currently open record and the user returns to the form after leaving it; another parent record can be set by the “SCHEDULEDEFAULTVALUE” function with the “pid” and “pform” identifiers. In the “OnBeforeDelete” and “OnAfterDelete” scripts, after the record has been deleted, the parent of the new record is the parent record of the deleted record, and after leaving the new record the user returns where they would have returned from the deleted record.

Example:

SCHEDULEFORM(susers)
 

void SCHEDULEFORM(int id, int record)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the edit form specified by the “id” parameter, and the opening of the record with the primary key specified by the “record” parameter immediately after the successful execution of the script. The “id” parameter can be found in admin mode in the tooltip, which is displayed after hovering the mouse pointer over the “Modify edit form” link. If the “record” parameter contains several values separated by a semicolon (for example a variable loaded from a database query), the first of them is used.

Example:

SCHEDULEFORM(1, 1)
 

void SCHEDULEFORM(string dbname, int record)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the edit form specified by the “dbname” parameter, and the opening of the record with the primary key specified by the “record” parameter immediately after the successful execution of the script. If the “record” parameter contains several values separated by a semicolon (for example a variable loaded from a database query), the first of them is used.

Example:

SCHEDULEFORM(susers, 1)
 

void SCHEDULEFORM(int id, int record, bool back)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the edit form specified by the “id” parameter, and the opening of the record with the primary key specified by the “record” parameter immediately after the successful execution of the script. The “id” parameter can be found in admin mode in the tooltip, which is displayed after hovering the mouse pointer over the “Modify edit form” link. The “back” parameter defines whether the browser window redirects to the main page (view page/portlet) at “true” or only back to the parent form at “false”. With the value “true”, a new record (the “record” parameter equal to “0”) has no parent record unless the “SCHEDULEDEFAULTVALUE” function with the “pid” and “pform” identifiers sets it. If the “record” parameter contains several values separated by a semicolon (for example a variable loaded from a database query), the first of them is used.

Example:

SCHEDULEFORM(1, 1, true)
 

void SCHEDULEFORM(string dbname, int record, bool back)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the edit form specified by the “dbname” parameter, and the opening of the record with the primary key specified by the “record” parameter immediately after the successful execution of the script. The “back” parameter defines whether the browser window redirects to the main page (view page/portlet) at “true” or only back to the parent form at “false”. With the value “true”, a new record (the “record” parameter equal to “0”) has no parent record unless the “SCHEDULEDEFAULTVALUE” function with the “pid” and “pform” identifiers sets it. If the “record” parameter contains several values separated by a semicolon (for example a variable loaded from a database query), the first of them is used.

Example:

SCHEDULEFORM(susers, 1, false)
 

void SCHEDULEMAILMESSAGE(string to, string cc, string bcc, string subject, string body, string attachments, bool save [, string c0, string v0 [, string c1, string v1...]])

Use: Script (where a comment is expected)

Description: The function schedules the opening of a page for entering a new e-mail message immediately after the successful execution of the script. On the new e-mail message page, the function fills in the input fields:

  • “To” by the “to” parameter,
  • “Cc” by the “cc” parameter,
  • “Bcc” by the “bcc” parameter,
  • “Subject” by the “subject” parameter,
  • “Message” by the “body” parameter.

Next, it attaches the file attachments specified by the “attachments” parameter to the message, and selects the “Save” check box if the value of the “save” parameter is equal to “True”. “Attachments” is a semicolon-separated list of file attachment IDs; a path to a file on disk is not attached. If the user selects the “Save” option before sending the e-mail message, the sent message is stored in the sent mail table of the “E-mail” application (the edit form with the “ng_mailoutbox” identifier); without this application, the message is not stored. The “c0” and “v0” parameters indicate the identifier of a database control of the sent mail table and the value that is inserted into this control when the message is stored, respectively. The identifiers “from”, “replyto” and “state” have a special meaning – they determine the sender of the message, the reply-to address and the state passed to the NETGenium.SendMessage external function.

Details
  • “from” determines the sender of the message if the user has no mail account in the “E-mail” application, or leaves the “From” field empty when having several accounts.
  • “replyto” prefills the “Reply to” field; the form offers it if any mail account of the user has a reply-to address filled in.
  • “state” passes the value to the NETGenium.SendMessage external function in the conn.Container2 object under the “state” key.

If the subject of the message starts, at the moment of sending, with an exclamation mark followed by a character other than another exclamation mark, the exclamation mark is removed from the subject and the message requests a read receipt – in the same way as with the “SENDMAILMESSAGE” function.

Example:

SCHEDULEMAILMESSAGE(info@netgenium.com, , , E-mail message, Dear Sir..., 0, true)
SCHEDULEMAILMESSAGE(info@netgenium.com, , , E-mail message, Dear Sir..., 1;#ng_attachment#, true)
 

void SCHEDULEPORTLETS()

Use: Script (where a comment is expected)

Description: The function schedules the main page to open immediately after the script executes successfully.

Example:

SCHEDULEPORTLETS()
 

void SCHEDULEPRINT(int button, int id)

Use: Script (where a comment is expected)

Description: The function schedules printing to the print template immediately after the successful execution of the script. The “button” parameter indicates the ID of the button that handles the printing, and the “id” parameter indicates the ID of the record to be printed. The selection of the print template is controlled by the setting of the operating button. If the button has a script, it is executed before printing and the record is saved according to the button settings; if the button script ends with an error, the printing is not performed. The script variables of the print template are taken from the button script; if the button has no script steps, they are taken from the script that called the function. If multiple “SCHEDULEPRINT” function calls are used in the script, the output is multiple printed files packaged in a “zip” archive, which is then offered for download.

Example:

SCHEDULEPRINT(123, 1)
 

void SCHEDULEPRINT(int button, int id, bool mergefiles)

Use: Script (where a comment is expected)

Description: The function schedules printing to the print template immediately after the successful execution of the script. The “button” parameter indicates the ID of the button that handles the printing, and the “id” parameter indicates the ID of the record to be printed. The selection of the print template is controlled by the setting of the operating button. If the button has a script, it is executed before printing and the record is saved according to the button settings; if the button script ends with an error, the printing is not performed. The script variables of the print template are taken from the button script; if the button has no script steps, they are taken from the script that called the function. If multiple “SCHEDULEPRINT” function calls are used in the script, the output is multiple printed files packaged in a “zip” archive, which is then offered for download. If all printed files have the same extension and they are printed to MS Excel print templates (XLS, XLSX or XLSM) or they are PDF files, the “mergefiles” parameter determines the output of the function; XLS and XLSX files are not merged together. If the “mergefiles” parameter is set to “true”, all printed files are merged into a single “xlsx” file with multiple sheets, or into a single PDF file. Merging takes place if the “mergefiles” parameter has the value “true” in any call of the function in the script. If all printed files are in the “xlsm” format, an “xlsm” file is created instead of an “xlsx” file.

Example:

SCHEDULEPRINT(123, 1, true)
 

void SCHEDULEPRINTOFATTACHMENT(int id)

Use: Script (where a comment is expected)

Description: The function schedules the printing of a file attachment immediately after the successful execution of the script. The “id” parameter indicates the ID of the file attachment that will be printed. If multiple “SCHEDULEPRINTOFATTACHMENT” function calls are used in the script, the output is multiple printed files packaged in a “zip” archive, which is then offered for download. The function call can also be freely combined with the “SCHEDULEPRINT” function.

Example:

SCHEDULEPRINTOFATTACHMENT(1)
 

void SCHEDULEPRINTOFATTACHMENT(int id, string filename)

Use: Script (where a comment is expected)

Description: The function schedules the printing of a file attachment immediately after the successful execution of the script. The “id” parameter indicates the ID of the file attachment that will be printed. Printing is performed to a file under the name specified by the “filename” parameter, which is specified without an extension – the extension of the original file is always appended to it. If multiple “SCHEDULEPRINTOFATTACHMENT” function calls are used in the script, the output is multiple printed files packaged in a “zip” archive, which is then offered for download. The function call can also be freely combined with the “SCHEDULEPRINT” function.

Example:

SCHEDULEPRINTOFATTACHMENT(1, Attachment)

Behavior common to the SCHEDULEPRINT and SCHEDULEPRINTOFATTACHMENT functions:

  • The “button” parameter of the “SCHEDULEPRINT” function must be the ID of a “Button” control of an edit form; a call with the ID of a button of a view page, with the ID of a button on the “Button” tab of a database control or with the “id” parameter equal to “0” is skipped.
  • The scheduled printing is performed only after the script of a button of the “Script” type (in an edit form as well as on a view page) and after the script of a button of a database control. In the scripts of form events (for example “OnAfterSave”), the scheduled printing is not performed.
  • Before printing each record, the “SCHEDULEPRINT” function runs the script of the service button over this record. If the script ends with an error, the printing is not performed at all and an error message is displayed to the user. Changes that the button script saved for the records processed earlier remain in the database.
  • The “SCHEDULEPRINT” function does not use the “Open a new email form” and “Open an edit form” options of the service button; a checked “1 nested record = 1 sheet (XLS) / 1 document (DOC)” field keeps only one sheet in a Microsoft Excel template and prints a Microsoft Word template to a single document.
  • Merging files according to the “mergefiles” parameter also includes attachments scheduled by the “SCHEDULEPRINTOFATTACHMENT” function if they have the same extension as the printed files; an attachment with a different extension switches the output to a “zip” archive. The attachment files stored in NET Genium are not changed by the merging.
  • Files printed to a print template are named in the “zip” archive with the word “Record” and the sequence number of the file padded with zeros on the left according to the number of scheduled prints (“Record 1”, “Record 2”...; in Czech “Zaznam 1”...) and the extension of the printed file. Attachments scheduled by the “SCHEDULEPRINTOFATTACHMENT” function keep their name in the archive. Diacritics are removed from the names of the files in the archive.

void SCHEDULEPRINTNAME(string filename)

Use: Script (where a comment is expected)

Description: The function schedules the print report file name specified by the “filename” parameter. The file name can be entered in multiple languages. The use of the function is only relevant in scripts that are used to print to a print template, and in the script of the “File” control run when a document is created with the “New from template” item, to which the scheduled name also applies; if it ends with the “.pdf” extension, the created document is converted to the PDF format. If a button of an edit form prints to a print template in the PDF format and the scheduled name ends with the “.htm” or “.html” extension, the result is printed in the HTML format. The scheduled name does not apply to the files printed by the “SCHEDULEPRINT” and “SCHEDULEPRINTOFATTACHMENT” functions, to the “zip” archive with them or to the attachment printed by the “PRINTATTACHMENT” function.

Example:

SCHEDULEPRINTNAME(Invoice - #ng_numberfv#)
 

void SCHEDULESAVE()

Use: Script (where a comment is expected)

Description: The function schedules the saving of the currently opened record in the edit form immediately after the successful execution of the script.

Example:

SCHEDULESAVE()
 

void SCHEDULESAVE(string dbname)

Use: Script (where a comment is expected)

Description: The function schedules the saving of the control of the currently opened record in the edit form immediately after the successful execution of the script. The function takes effect only in the “OnAfterOpen” script, where it writes the value of the column to the database without the user saving the record; it has no effect in other scripts.

Example:

SCHEDULESAVE(ng_textbox)
 

void SCHEDULESCRIPT(int button)

Use: Script (where a comment is expected)

Description: The function schedules the execution of the script assigned to the button in the view page specified by the “button” parameter immediately after the successful execution of the script, regardless of whether the “Run script” option is checked and of the command type of the button; the button command itself is not performed. (The order of the comment line in the script does not matter, the scheduled script will only run after all script steps have been executed.) The “button” parameter can be found in admin mode in the tooltip, which appears after stopping the mouse pointer over the “Modify Button ID ...” link or over the “Modify script” link. If an error occurs during the execution of the scheduled script, this error is logged in the “Errors.log” log file. If a user ran the script in an edit form or on a view page (by saving or deleting a record, by a button), an error message is also displayed to them.

Example:

SCHEDULESCRIPT(1)
 

void SCHEDULESCRIPT(int button, int id)

Use: Script (where a comment is expected)

Description: The function schedules the execution of the script assigned to the button in the edit form specified by the “button” parameter immediately after the successful execution of the script. The “button” parameter can be found in admin mode in the tooltip, which appears after stopping the mouse pointer over the “Modify Button ID ...” link or over the “Modify script” link. The “button” parameter must be the ID of a “Button” control; the function does not run the script of a button on the “Button” tab of a database control, the call is skipped and written to the “Errors.log” log file. The “id” parameter defines the ID of the record whose data will be used to run the script. After the completion of the script, the record with this ID will be saved in the database, if the button is set to save the record after the successful execution of the script. But the script “OnBeforeSave” and “OnAfterSave” will not run. If an error occurs during the execution of the scheduled script, this error is logged in the “Errors.log” log file. If a user ran the script in an edit form or on a view page (by saving or deleting a record, by a button), an error message is also displayed to them.

Example:

SCHEDULESCRIPT(1, 1)

Behavior common to both variants of the SCHEDULESCRIPT function:

  • The scheduled scripts run synchronously on the same thread, only after the entire script that scheduled them has finished; each runs in its own database transaction committed separately. They do not run in the background.
  • They run in the order in which they were scheduled in the script. If a scheduled script itself schedules further scripts, those run immediately after it (depth-first), and only then do the remaining scheduled scripts continue.
  • Scheduling the same script repeatedly runs it only once. Two calls are considered the same when they use the same button (for the variant with the “id” parameter, the same combination of button and “id”); the second and any further scheduling is ignored. Calls of the same button with a different “id”, on the other hand, all run. This protection also prevents an endless loop in which scripts would schedule one another indefinitely.
  • If an error occurs while executing one of the scheduled scripts, the remaining scripts in the queue to which this script belongs are no longer executed. Scripts completed before the error remain saved in the database. An error in a script scheduled by another scheduled script stops only the queue of scripts scheduled by that script; the remaining scripts of the parent queue are executed.
  • In the scripts of the “OnAfterOpen”, “OnBeforeSave” and “OnBeforeDelete” events and in a test run of a script, the scheduled scripts do not run. A button that does not exist is skipped and written into the “Errors.log” log file.
  • Access rights to the button and to the record are not checked.
  • For the variant with the “id” parameter, nothing is executed – not even saving the record – if the button script is empty or the record does not exist. Of the button settings, only saving the record after the script applies; saving before the script is not performed.

void SCHEDULESYNC()

Use: Script (where a comment is expected)

Description: The function schedules that all synchronized columns, not only the changed ones, are queued for synchronization when the currently open record is saved in the edit form. The synchronization conditions of the record and of the individual columns still apply.

Example:

SCHEDULESYNC()
 

void SCHEDULEURL(string url)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the web page specified by the “url” parameter immediately after the successful execution of the script.

Example:

SCHEDULEURL(https://www.netgenium.com)
 

void SCHEDULEVIEWPAGE(int viewpage)

Use: Script (where a comment is expected)

Description: The function schedules the opening of the view page specified by the “viewpage” parameter immediately after the successful execution of the script. The “viewpage” parameter can be found in admin mode in the tooltip that appears after hovering the mouse pointer over the “Modify view page” link.

Example:

SCHEDULEVIEWPAGE(1)
 

double SIN(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the sine from the value specified by the “number” parameter. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

SIN(-1.23)
// Returns “-0,942488801931697”
SIN(1.23)
// Returns “0,942488801931697”
SIN(#A#)
 

void SKIPDELETE()

Use: Script (where a comment is expected)

Description: The function prevents deleting the currently open record in the edit form. In the “OnBeforeDelete” script run by a bulk deletion of records from the view table, it prevents deleting the record that is being processed. The changes written by the script commands that the script has not committed with the “COMMIT()” function are not performed. The script transaction is still committed, so writes made by external functions through the passed “cmd” object remain.

Example:

SKIPDELETE()
 

void SKIPSAVE()

Use: Script (where a comment is expected)

Description: The function prevents the currently open record from being saved in the edit form. The changes written by the script commands are performed in the edit form; when the script is run other than by saving the edit form – for example by a multiple change, by a change of a value in the view table, in the details panel of a view table, on a card of the Kanban control or in the details of the Tree control, by an import from Excel or by the “OBSOAS” function – only those that the script committed with the “COMMIT()” function are performed. The script transaction is still committed even then: writes made by external functions through the passed “cmd” object remain and emails queued by the “Send email” command are sent. In the script of a button, the function skips saving the record after the script (step “3. Save the record” and the forced saving of the “Open an edit form” type), and in the “OnAfterOpen” script it cancels the saving scheduled by the “SCHEDULESAVE()” function without a parameter.

Example:

SKIPSAVE()
 

void SLEEP(int milliseconds)

Use: Script (where a comment is expected)

Description: The function pauses the script for “milliseconds” milliseconds. With a value of zero or a negative value it does not pause the script.

Example:

SLEEP(1000)
 

int SPLIT(string value, string separator)

Use: HTML, JavaScript, Script

Description: The function returns the number of elements in the text string specified by the “value” parameter split by the value defined by the “separator” parameter. The function call must respect the uppercase letters in the function name (“SPLIT”) – a name written in lowercase or mixed case will not be evaluated.

Example:

SPLIT(A;B;C, ";") // Returns “3”
SPLIT(1;2;5;6;8, ";") // Returns “5”
SPLIT(A, ";") // Returns “1” (no separator found, but one element exists)
SPLIT(, ";") // Returns “1” (an empty string is still one element)
 

string SPLIT(string value, string separator, int index)

Use: HTML, JavaScript, Script

Description: The function returns the element at the position specified by the “index” parameter in the text string specified by the “value” parameter split by the value defined by the “separator” parameter. The index uses zero-based numbering. If the specified index is out of range, the function returns an empty string. The function call must respect the uppercase letters in the function name (“SPLIT”).

Example:

SPLIT(A;B;C, ";", 0) // Returns “A”
SPLIT(1;2;5;6;8, ";", 3) // Returns “6”
SPLIT(A;B;C, ";", 5) // Returns “” (index out of range)
SPLIT(A;B;C, ";", 2) // Returns “C”
 

string SQL(string query)

Use: HTML, JavaScript, Script

Description: The function returns the value from the first row and the first column of the database query specified by the “query” parameter. If commas are included in the database query, it is necessary to enclose the entire query in double quotes. Variables and nested server function calls are still evaluated inside these quotation marks (see chapter 1.4.). If the query returns more columns in JavaScript, the function returns the first row of the result as a JavaScript array (e.g. “[1, 'Administrator', 'en']”). If the query returns no row, the function returns an array of empty values – “0” for numeric columns and an empty text for text and date columns –, so the non-existence of a record has to be tested by a value, for example the ID, not by the array itself. If the call in JavaScript is written directly as a parameter of a call whose name is “eval” regardless of the letter case (only the letters and digits before the parenthesis are taken as the name, see chapter 1.1., so this is for example the “bt_Eval” JavaScript function), the function returns, instead of the result, the address of a page from which the browser loads the result of the query only with a separate request; the query is executed only then. The function returns a decimal number with a decimal point. If the query ends with an error, the function returns the error text. The query must begin with the SELECT statement and contain a FROM clause, and outside text literals in apostrophes it must not contain the word UPDATE, DELETE, ALTER or DROP; a query after a semicolon or after the word UNION and a nested SELECT query in parentheses must pass the same check. Otherwise the call is not evaluated and stays in the text (see chapter 1.6.). The same applies to the variants with a separator. The check protects against an incorrectly written query, but it does not catch every statement that changes the data or the structure of the database. The check of the query notation does not replace the treatment of inserted values – values of variables and controls inserted into the query must be formatted by the “FORMAT...SQL” functions, for example “FORMATSTRINGSQL”, “FORMATINTSQL”, “FORMATDOUBLESQL” or “FORMATDATESQL”.

Example:

SQL("SELECT * FROM susers")
 

string SQL(string query, string separator)

Use: HTML, JavaScript, Script

Description: The function returns the result of the database query specified by the “query” parameter. If commas are included in the database query, it is necessary to enclose the entire query in double quotes. Variables and nested server function calls are still evaluated inside these quotation marks (see chapter 1.4.). The query result values are separated by the separator specified by the “separator” parameter; empty values are omitted together with their separator. The delimiter can be defined for each individual column separately as a semicolon-separated list of values. In this case, as many delimiters as the number of columns – 1 must be defined, and the individual rows of the result are separated by the last delimiter in the list. If the number of semicolon-separated items matches the number of columns – 1, the parameter is always taken as a list, so a semicolon cannot be part of a delimiter in that case. The function outputs decimal numbers without converting them to a decimal point. If the separator “ - ” (a hyphen with spaces) separates two values with a date and time of the same day, the second of them is output only as a time.

Example:

SQL("SELECT id, loginname, lng FROM susers", " - ")
SQL("SELECT id, loginname, lng FROM susers", " - ; -- ")

If the “separator” parameter (for the variant with three parameters the “columnSeparator” parameter) ends with the characters “++” and the query reads from the table of an edit form, the function outputs only the “id” and “pid” columns and the columns of the database controls of the form to which the logged-in user has rights; the columns of the other controls are omitted. It inserts the name of the control with a colon before each value (the text “ID” and “PID” for the “id” and “pid” columns) and translates text values according to the language of the logged-in user; the characters “++” are not counted as part of the separator.

string SQL(string query, string columnSeparator, string lineSeparator)

Use: HTML, JavaScript, Script

Description: The function returns the result of the database query specified by the “query” parameter. If commas are included in the database query, it is necessary to enclose the entire query in double quotes. Variables and nested server function calls are still evaluated inside these quotation marks (see chapter 1.4.). The columns of the query result values are separated by the “columnSeparator” parameter, and the individual rows are separated by the “lineSeparator” parameter; empty values are omitted together with their separator. The “columnSeparator” can be defined for each individual column separately as a semicolon-separated list of values. In this case, as many delimiters as the number of columns – 1 must be defined. If the number of semicolon-separated items matches the number of columns – 1, the parameter is always taken as a list, so a semicolon cannot be part of a delimiter in that case. The function outputs decimal numbers without converting them to a decimal point. If the column separator “ - ” (a hyphen with spaces) separates two values with a date and time of the same day, the second of them is output only as a time.

Example:

SQL("SELECT id, loginname, lng FROM susers", " - ", <br>)
SQL("SELECT id, loginname, lng FROM susers", " - ; -- ", <br>)
 

string SQLARRAY(string query)

Use: HTML, JavaScript

Description: The function returns the result of the database query specified by the “query” parameter. If commas are included in the database query, it is necessary to enclose the entire query in double quotes. Variables and nested server function calls are still evaluated inside these quotation marks (see chapter 1.4.). The database query returns an array of fields in the form of javascript. The query must pass the same check of the query notation as for the “SQL” function; otherwise the call is not evaluated and stays in the text (see chapter 1.6.).

Example:

SQLARRAY("SELECT id, loginname, lng FROM susers WHERE id <= 2")

Example result:
[
[1, 'Administrator', 'en'],
[2, 'Anonymous', 'en']
]
 

string SQLQUERY(string control)

Use: Script

Description: The function returns the SQL query of the control specified by the “control” parameter. The “control” parameter indicates the name of the control element according to the conventions used in variables or print templates:

  • datagridX
  • DGX
  • calendarX, timetableX, plannerX and treeX – the query of a calendar, a time table (TimeTable), a planner (Planner) and a tree

Example:

SQLQUERY(datagrid1)
SQLQUERY(DG123)
 

string SQLTABLE(string query, string key1, [string key2, string key3...])

Use: HTML, JavaScript, Script, an expression in the virtual column of a statistical query. The “SQLTABLE” function is used mainly in the virtual column of a statistical query as an optimized variant of the “SQL” function, whose call in each row of the statistical query leads to problems with the loading speed of the resulting statistical query – the “SQL” function is run as many times as there are rows in the loaded query.

Description: The function reads the database query specified by the “query” parameter, which is defined by grouping the data of the “GROUP BY” clauses, and returns the value of the last column from “query” for the row defined by the “key1”, “key2”, etc.... The query must pass the same check of the query notation as for the “SQL” function; otherwise the call is not evaluated and stays in the text (see chapter 1.6.). The query result is loaded into virtual table in memory, and a key-value dictionary is built from the individual rows of the table. The number of table columns that define a unique key is determined by the number of keys used in the “key1”, “key2”, etc. parameters. The column that defines the value is always the last column in the query. A key that is not found returns an empty string, as does a query that has no further column after the key columns. If a key repeats in more rows of the result, the first of them applies. The query result is loaded only at the first call and is then used for the same query text and the same number of keys for as long as the database connection is open – usually until the end of processing the request or running the script –, so changes written in the meantime are not reflected in it; this does not apply if a transaction is in progress over the connection.

Example - non-optimized variant using the “SQL” function:

Number of items@SQL("SELECT COUNT(*) FROM ng_item WHERE pid = FORMATINTSQL(#c0#)")

Example – optimized variant using the “SQLTABLE” function:

Number of items@SQLTABLE("SELECT pid, COUNT(*) FROM ng_item GROUP BY pid", #c0#)
 

double SQUARE(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the square root of the positive number specified by the “number” parameter.

Example:

SQUARE(-5.22)
// Returns “NaN”
SQUARE(5.22)
// Returns “2,28473193175917”
SQUARE(#A#)
 

string[] StringArray(string text1; string text2; ...)

Use: Script

Description: The function declares a script variable of the field type of values “String” from individual values specified by parameters “text1”, “text2”, etc. The function parameters are separated by a semicolon or a tab. The “StringArray” function call must be case sensitive in the function name.

Example:

StringArray(a;b;c)
StringArray(a#tab#b#tab#c)
 

int SUBSTRACTDATES(DateTime date1, DateTime date2)

Use: HTML, JavaScript, Script

Description: The function returns the difference between the dates specified by the parameters “date1” and “date2” expressed in minutes and rounded to whole minutes; half a minute is rounded away from zero. The difference in seconds is returned by the “SUBSTRACTDATES2” function. If either parameter is not a valid date, the function returns “0”.

Example:

SUBSTRACTDATES(#today# + 14, #today#)
// Returns “20160” (14 * 60 * 24)
 

double SUBSTRACTDATES2(DateTime date1, DateTime date2)

Use: HTML, JavaScript, Script

Description: The function returns the difference between the dates specified by the parameters “date1” and “date2” expressed in seconds. If either parameter is not a valid date, the function returns “0”.

Example:

SUBSTRACTDATES2(#today# + 14, #today#)
// Returns “1209600” (14 * 60 * 24 * 60)
 

int SUBSTRACTINTEGERS(int value1, int value2)

Use: HTML, JavaScript, Script

Description: The function returns the difference of the two integers specified by the “value1” and “value2” parameters.

Example:

SUBSTRACTINTEGERS(10, 1)
// Returns “9”
 

string SUBSTRING(string text, int startindex, int length)

Use: HTML, JavaScript, Script

Description: The function returns a substring from the string specified by the “text” parameter, starting with the character at the position stored in the “startindex” parameter with the length stored in the “length” parameter. If the value of the “length” parameter is “-1”, it returns a substring starting with the character at the position stored in the “startindex” parameter to the end of the string. A negative value of the “length” parameter behaves in the same way as “-1”. If the “length” parameter is greater than the remaining part of the string, the function returns the string up to its end. If the “startindex” parameter is greater than or equal to the length of the string, the function returns an empty string; if it is negative, the function returns the whole string.

Example:

SUBSTRING(Hello World, 6, 5)
// Returns “World”
SUBSTRING(Hello World, 6, -1)
// Returns “World”
 

double SUM(object[] array)

Use: Script

Description: The function returns the sum of the values of the script variable specified by the “array” parameter, if the variable is an array of values. If the variable is not an array of values, the function returns the value of the variable. The function takes text values – even those of a variable that is not an array of values – as time values in the “HH:mm” format and returns the sum in minutes. If the array does not contain any element, the function returns “0”. The function counts the values of a variable of the “Date” type as “0”, so it returns “0” for such a variable. The function returns a decimal number with a decimal point.

Example:

SUM(#A#)
 

void TABLE(string id)

Use: HTML control name – The body of the control must be left blank

Description: The function starts a new table – it generates the HTML code “<table id="{id}" cellspacing="0" cellpadding="0"><tr><td>”, i.e. it also opens the first row and its first cell. The table ID is defined by the “id” parameter.

Example:

TABLE(T1)
 

void TABLE(string id, bool visible)

Use: HTML control name – The body of the control must be left blank

Description: The function starts a new table in the same way as the “TABLE(string id)” function. Unless the “visible” parameter has the value “true” (regardless of letter case), the table is hidden in user mode (the “display:none” style) – it is therefore hidden also by a value such as “0” or “1”.

Example:

TABLE(T1, false)
 

void /TABLE

Use: HTML control name – The body of the control must be left blank

Description: The function closes the current cell, row and the table started by the “TABLE” function – it generates the HTML code “</td></tr></table>”. The function can also be written with parentheses, for example “/TABLE(T1)” – the content of the parentheses is not used –, and it is recognized even if the body of the control is not empty – the content of the body is then not output. The same applies to the “/DIV” function.

Example:

/TABLE
 

double TAN(double number)

Use: HTML, Script (only in a numeric expression, e.g. in a value assigned to a numeric variable)

Description: The function returns the tangent from the value specified by the “number” parameter. If the name is written in lower case immediately after a dot, the call is not evaluated and is preserved for the browser.

Example:

TAN(-0.56)
// Returns “-0,626949535052698”
TAN(1)
// Returns “1,5574077246549”
TAN(#A#)
 

void TD

Use: HTML control name – The body of the control must be left blank

Description: The function closes the current table cell and starts a new one – it generates the HTML code “</td><td>”.

Example:

TD
 

void TEFUIG(string message, string group1, string group2, ...)

Use: Script

Description: The function triggers an interrupt with an error message specified by the “message” parameter to all users who are members of the “group1”, “group2” ... groups, and terminates the execution of the script. The number of parameters with a list of groups is arbitrary. Without any group specified, the function does not trigger the interrupt. The text of the message can be entered in multiple languages. The groups are specified by the IDs of user groups; a group name cannot be used. Membership also includes the groups that the “NETGenium.OpenForm” or “NETGenium.OpenViewPage” external function temporarily assigned to the user for the edit form or view page. The built-in Administrator account always satisfies the group with ID 1.

Example:

TEFUIG(You are not authorized to perform this activity., 6, 21)
TEFUIG("Message containing a comma.", 6, 21)
 

string TEMPPASSWORD()

Use: HTML, JavaScript, Script

Description: The function generates a short temporary numeric password using a cryptographically secure random number generator. It is intended as a one-time password that the user changes to a secure one after signing in; it is therefore intentionally numeric and short so that it is easy to type. The function only returns the generated number – it does not set any password and does not enforce a password change after signing in. A temporary password is set for users by the “RESETUSERPASSWORD” function.

Example:

TEMPPASSWORD()
// Returns a random numeric temporary password, e.g. “482915”
 

void TESUIG(string message, string group1, string group2, ...)

Use: Script

Description: The function triggers an interrupt with an error message specified by the “message” parameter to all users who are not members of the “group1”, “group2” ... groups, and terminates the execution of the script. The number of parameters with a list of groups is arbitrary. The groups are specified by the IDs of user groups; a group name cannot be used. The text of the message can be entered in multiple languages. The function appends the sentence “Allowed only for {0}.” to the message, where {0} is the list of names of the specified groups translated according to the language of the logged-in user. Without any group specified, the function always triggers the interrupt, with the message alone and without the appended sentence. Membership also includes the groups that the “NETGenium.OpenForm” or “NETGenium.OpenViewPage” external function temporarily assigned to the user for the edit form or view page. The built-in Administrator account always satisfies the group with ID 1.

Example:

TESUIG(You are not authorized to perform this activity., 9, 3)
TESUIG("Message containing a comma.", 9, 3)
 

void THROWEXCEPTION(string exception)

Use: HTML and JavaScript (only in user mode), Script (where a comment is expected)

Description: The function triggers an interrupt with an error message specified by the “exception” parameter. The text of the message can be entered in multiple languages.

Example:

THROWEXCEPTION(abc)
 

int TIME2INT(string time)

Use: HTML, JavaScript, Script

Description: The function returns the number of minutes converted from the text string – time – specified by the “time” parameter in the format “HH:mm”. A value without a colon returns “0” and the function does not count the seconds part of the notation “HH:mm:ss”. The number of hours is not limited to 24 (“25:00” returns “1500”) and a notation starting with a minus sign returns a negative number of minutes.

Example:

TIME2INT(08:00)
// Returns “480”
TIME2INT(00:00)
// Returns “0”
 

int TIME2MINUTES(string time)

Use: HTML, JavaScript, Script

Description: The function returns the number of minutes converted from the text string – time – specified by the “time” parameter in the format “HH:mm”. A value without a colon returns “0” and the function does not count the seconds part of the notation “HH:mm:ss”. The number of hours is not limited to 24 (“25:00” returns “1500”) and a notation starting with a minus sign returns a negative number of minutes.

Example:

TIME2MINUTES(08:00)
// Returns “480”
TIME2MINUTES(00:00)
// Returns “0”
 

double TIME2SECONDS(string time)

Use: HTML, JavaScript, Script

Description: The function returns the number of seconds converted from the text string – time – specified by the “time” parameter in the format “HH:mm:ss”. A value that does not have exactly three parts separated by a colon (for example “08:00”) returns “0”. The number of hours is not limited to 24 and a notation starting with a minus sign returns a negative number of seconds.

Example:

TIME2SECONDS(00:08:00)
// Returns “480”
TIME2SECONDS(00:00:00)
// Returns “0”
 

void TR

Use: HTML control name – The body of the control must be left blank

Description: The function closes the current cell and row of the table and starts a new row with its first cell – it generates the HTML code “</td></tr><tr><td>”.

Example:

TR
 

string TRANSLATE(string text [, string language])

Use: HTML, JavaScript, Script

Description: The function returns the language translation of the multilingual term specified by the “text” parameter. Without the “language” parameter, the text is translated into the language of the logged-in user, otherwise into the language specified by the “language” parameter (language code in lowercase). If the text has no translation into the given language, the function returns the default text before the first language marker without any prefix consisting of two lowercase letters without diacritics and a colon; if the text starts with a language marker, it returns the first language version. The function is also evaluated in the content of the “RichText” and “Title” controls, where it is used to translate short labels. However, the notation “translate(” in lower case that is not preceded by a letter, a digit, an underscore, the “$” character, a dot, a quotation mark, an apostrophe or a hyphen and does not stand in a CSS “transform:” declaration is not evaluated as a server function in JavaScript, in the content of the HTML, RichText and Title controls of an edit form, in the texts of the controls of a view page, in a portlet with an HTML or RichText control on the main page and in the copyright of the navigation area, because NET Genium rewrites it to a call of a JavaScript function; the server function is therefore written in upper case. If the text contains a comma, it must be enclosed in double quotes – otherwise the part after the comma is used as the “language” parameter.

Example:

TRANSLATE(Schvalování bylo stornováno#en:Approval has been canceled)
TRANSLATE(Schvalování bylo stornováno#en:Approval has been canceled,
#language#)
TRANSLATE("Pořadí, doplněné zleva nulami#en:The order, padded with zeros")
 

string TREECHILDNODES(string dbname, int id)

Use: HTML, JavaScript, Script

Description: The function returns a list of IDs separated by semicolons, obtained from the table used in the tree structure. The IDs represent all descendants of the record specified by the “id” parameter. The search is performed recursively, which means that the function searches not only for direct descendants, but also for their further child records. The value “0” of the “id” parameter returns the IDs of all records of the tree. Only records without a parent form or nested in the same form are counted; for a record without descendants and for a non-existent ID the function returns an empty string.

Example:

TREECHILDNODES(ng_abc, 1)
// Returns “2;3;4”
 

string TREEPICKER(int picker, long id3, long pid3, string label, int viewpage)

Use: Edit form HTML

Description: The function generates an HTML link with the text specified by the “label” parameter (translated according to the user's language), which opens a window with a tree picker. The tree is rendered according to the first Tree control on the view page specified by the “viewpage” parameter (view page ID) to which the user has rights, provided the user also has rights to the page itself; if the user has no rights to the page or the page has no such control, the tree is built from the query of the picker of the control specified by the “picker” parameter. The “picker” parameter is the ID of the control with a picker whose value assignments are used after a node is selected; if the picker has no value assignments, the window closes immediately. The “id3” parameter is the ID of the record to which the values are assigned, and “pid3” the ID of its parent record (used for a record that has not yet been saved).

Example:

TREEPICKER(4321, #id#, #pid#, Select category, 42)
// Generates a link; clicking it opens a tree picker for categories
 

string TRIM(string text)

Use: HTML, JavaScript, Script

Description: The function returns a text string specified by the “text” parameter, in which white-space characters (spaces, tabs, line breaks and non-breaking spaces) have been removed at the beginning and at the end. The form “s.trim()” — lower case after a dot with empty parentheses — is not evaluated and is preserved for the browser.

Example:

TRIM( Good morning )
// Returns “Good morning”
 

string TRIM(string text, string trimchars)

Use: HTML, JavaScript, Script

Description: The function returns a text string specified by the “text” parameter, in which all characters specified in the “trimchars” parameter have been removed at the beginning and at the end.

Example:

TRIM(010, 023)
// Returns “1”
 

string TRIMEND(string text)

Use: HTML, JavaScript, Script

Description: The function returns a text string specified by the “text” parameter, in which white-space characters (spaces, tabs, line breaks and non-breaking spaces) have been removed at the end. The form “s.trimEnd()” — in this exact form after a dot with empty parentheses — is not evaluated and is preserved for the browser.

Example:

TRIMEND(Good morning )
// Returns “Good morning”
 

string TRIMEND(string text, string trimchars)

Use: HTML, JavaScript, Script

Description: The function returns a text string specified by the “text” parameter, in which all characters specified in the “trimchars” parameter have been removed at the end.

Example:

TRIMEND(010, 023)
// Returns “01”
 

string TRIMSTART(string text)

Use: HTML, JavaScript, Script

Description: The function returns a text string specified by the “text” parameter, in which white-space characters (spaces, tabs, line breaks and non-breaking spaces) have been removed at the beginning. The form “s.trimStart()” — in this exact form after a dot with empty parentheses — is not evaluated and is preserved for the browser.

Example:

TRIMSTART( Good morning)
// Returns “Good morning”
 

string TRIMSTART(string text, string trimchars)

Use: HTML, JavaScript, Script

Description: The function returns a text string specified by the “text” parameter, in which all characters specified in the “trimchars” parameter have been removed at the beginning.

Example:

TRIMSTART(010, 023)
// Returns “10”
 

void UPDATEAUTOSUM(int id, int form)

Use: Script (where a comment is expected)

Description: The function recalculates and saves the values of all “AutoSum” controls of the record specified by the “id” parameter in the edit form specified by the “form” parameter.

Example:

UPDATEAUTOSUM(1, 1)
UPDATEAUTOSUM(#id#, #form#)
 

void UPDATEAUTOSUM(string id, int form)

Use: Script (where a comment is expected)

Description: The function recalculates and saves the values of all “AutoSum” controls of the records specified by the “id” parameter (field of values separated by a semicolon) in the edit form specified by the “form” parameter.

Example:

UPDATEAUTOSUM(1;2;3, 1)
 

void UPDATEAUTOSUM(int id, string dbname)

Use: Script (where a comment is expected)

Description: The function recalculates and saves the values of all “AutoSum” controls of the record specified by the “id” parameter in the edit form specified by the “dbname” parameter.

Example:

UPDATEAUTOSUM(1, susers)
 

void UPDATEAUTOSUM(string id, string dbname)

Use: Script (where a comment is expected)

Description: The function recalculates and saves the values of all “AutoSum” controls of the records specified by the “id” parameter (semicolon-separated value fields) in the edit form specified by the “dbname” parameter.

Example:

UPDATEAUTOSUM(1;2;3, susers)

Behavior common to all variants of the UPDATEAUTOSUM function:

  • The function recalculates and writes the sums immediately, outside the script transaction – a later error of the script does not undo the result.
  • The function reads only committed data. If the sums are to include writes performed earlier by the script, they have to be committed beforehand by the “COMMIT()” function, for example “COMMIT() UPDATEAUTOSUM(#id#, #form#)”.
  • The save is written to the change history and added to the synchronization queue in the same way as saving the edit form; the save scripts of the form, however, are not run.
  • A record that does not exist in the table is skipped without any message.
  • The function is not executed in a test run of the script.

string UPLOADBUTTON(string title, int width, int height, string accept, string control1 [, string control2...])

Use: Edit form HTML

Description: The function renders a button in an edit form for selecting and uploading multiple files at once. It allows inserting multiple files at once in an edit form, or selecting and uploading multiple file attachments simultaneously — clicking the button opens a dialog for selecting one or more files. The “title” parameter specifies button text, “width” and “height” its dimensions in pixels, “accept” the accepted file type filter, and the remaining parameters are database names of file controls that receive uploaded files in sequence. The DROPZONE function serves the same purpose (uploading multiple files at once) but renders a drag-and-drop area instead of a button.

The “accept” parameter can contain file extensions (“.jpg,.jpeg,.png”), MIME types (“application/pdf”, “image/*”), “*” or an empty string for any file type. The value “camera” on its own offers taking a photo directly with the camera of the device (accepts images); it cannot be combined with extensions. A width of 0 uses the default width of the button; if the text of the button is wider, the button widens to fit it. A height of 0 uses the default height.

Examples:

UPLOADBUTTON(Upload PDF, 160, 32, application/pdf, ng_attachment1, ng_attachment2)
CONTROL(Upload from gallery, UPLOADBUTTON(Upload, 150, 30, ".jpg,.jpeg,.png", ng_file1, ng_image1), )
CONTROL(Take photo, UPLOADBUTTON(Upload, 150, 30, "image/*", ng_file1, ng_image1), )
CONTROL(Take photo, UPLOADBUTTON(Take photo, 150, 30, camera, ng_file1, ng_image1), )
CONTROL(Take photo, UPLOADBUTTON(Upload, 150, 30, "", ng_file1, ng_image1), )
CONTROL(Take photo, UPLOADBUTTON(Upload, 0, 0, "*", ng_file1, ng_image1), )
 

string UPPER(string text)

Use: HTML, JavaScript, Script

Description: The function returns the text string specified by the “text” parameter, in which all characters are converted to uppercase.

Example:

UPPER(abc)
// Returns “ABC”
 

string URLDECODE(string text)

Use: HTML, JavaScript, Script

Description: The function decodes all URL hexadecimal characters in the text string specified by the “text” parameter. The function converts the “+” character to a space.

Example:

URLDECODE(https%3a%2f%2fwww.netgenium.com)
// Returns “https://www.netgenium.com”
 

string URLENCODE(string text)

Use: HTML, JavaScript, Script

Description: The function encodes all URL invalid characters (e.g. a space) in the text string specified by the “text” parameter into the corresponding sequence of characters in hexadecimal. The function encodes a space as the “+” character.

Example:

URLENCODE(https://www.netgenium.com)
// Returns “https%3a%2f%2fwww.netgenium.com”
 

string USERDETAILS(string columnname)

Use: HTML, JavaScript, Script

Description: The function returns the value stored in the user database table in the column specified by the “columnname” parameter on the row that relates to the currently logged in user. The function does not return the values of columns whose name contains “password” or “md5”. If the column specified by the “columnname” parameter does not exist, the call is not evaluated and stays in the text (see chapter 1.6.). The values are loaded when the user logs in, so a later change of the user's record takes effect only after a new login; if the user saves their own record in the user form, the values are refreshed in the session in which the record was saved.

Example:

USERDETAILS(id)
USERDETAILS(loginname)
 

string USERGROUP(string loginname)

Use: HTML, JavaScript, Script

Description: The function returns a semicolon-separated list of all user group names in which the user specified by the “loginname” parameter is a member. It returns the names in their stored form, so a multilingual name including all language versions (for example “Obchod#en:Sales”), and in no defined order.

Example:

USERGROUP(Administrator)
USERGROUP(#loginname#)
 

string USERINGROUP(string group1 [, string group2, ...])

Use: HTML, JavaScript, Script

Description: The function returns the value “x” if the currently logged in user is a member of the user group specified by the “group1” parameter, or a member of more groups specified by other parameters. The function returns the value “” if it is not a member of this user group. “Group” can be the ID of the user group or its name. Membership also includes the groups that the “NETGenium.OpenForm” or “NETGenium.OpenViewPage” external function temporarily assigned to the user for the edit form or view page – but only when the ID of the group is specified; the name of a group is compared only with the permanent groups of the user, with the whole stored name (for a multilingual name including all language versions, for example “Obchod#en:Sales”) and case-sensitively; for a multilingual group it is therefore more reliable to specify the ID. A user with administrator rights always satisfies the group with ID 1 and the name “Administrators”.

Example:

USERINGROUP(1)
USERINGROUP(Administrators)
USERINGROUP(1, 2)
USERINGROUP(Administrators, Users)
// Returns “” or “x”
 

string USERSINGROUP(int group1 [,... int group2])

Use: HTML, JavaScript, Script

Description: The function returns a list of all user IDs separated by a semicolon who are members of a group specified by the “group1” parameter, or multiple groups specified by other parameters.

Example:

USERSINGROUP(1)
USERSINGROUP(1, 2)
// Returns for example “1”, “1;2” etc.
 

string USERSINGROUP(string group1 [,... string group2])

Use: HTML, JavaScript, Script

Description: The function returns a list of all user IDs separated by a semicolon who are members of a group specified by the “group1” parameter, or multiple groups specified by other parameters.

Example:

USERSINGROUP(Administrators)
USERSINGROUP(Administrators, Users)
// Returns for example “1”, “1;2” etc.
 

string USERSINGROUP2(int group1 [,... int group2])

Use: HTML, JavaScript, Script

Description: The function returns a semicolon-separated list of the login names of all users who are members of the group specified by the “group1” parameter, or of multiple groups specified by other parameters.

Example:

USERSINGROUP2(1)
USERSINGROUP2(1, 2)
// Returns for example “Administrator”, “Administrator;Anonymous” etc.
 

string USERSINGROUP2(string group1 [,... string group2])

Use: HTML, JavaScript, Script

Description: The function returns a semicolon-separated list of the login names of all users who are members of the group specified by the “group1” parameter, or of multiple groups specified by other parameters.

Example:

USERSINGROUP2(Administrators)
USERSINGROUP2(Administrators, Users)
// Returns for example “Administrator”, “Administrator;Anonymous” etc.

Behaviour common to the USERSINGROUP and USERSINGROUP2 functions:

  • Each parameter may contain several groups separated by a tab, so the value of a MultiListBox control can be passed directly. Group IDs and names may be combined in the parameters.
  • The name of a group is compared with the whole stored name, so for a multilingual name including all language versions (for example “Obchod#en:Sales”); for a multilingual group it is therefore more reliable to specify the ID.

string VALIDEMAIL(string email)

Use: HTML, JavaScript, Script

Description: The function tests the correct format of the e-mail address specified by the “email” parameter. If so, the function returns an “x”. If the e-mail address is not in the correct format, the function returns an empty string.

Example:

VALIDEMAIL(info@netgenium.com)
// Returns “x”
 

void WEBFORM

Use: Note of the edit form or HTML control name (the body of the control must be left blank)

Description: The function starts a block of controls that do not use a colored background in the left column with the control's name, and that use a reverse design – the controls do not have a frame, have a colored background, and display a colored bar below the control. In user mode, buttons, the DataGrid and LiteDataGrid view tables and the Calendar, TimeTable, Planner, Kanban, Chart, Map and Tree visual controls that are not snapped to the previous control are displayed in the block without the left column with the name, starting at the left edge of the form.

A started block that is not terminated with the “/WEBFORM” function anchors the “Save”, “Delete” and “Back” buttons. These buttons will then not be floating, and will always be displayed at the end of the edit form.

Details
  • Within the block, the icon for opening the address is not displayed after the name of a TextBox control with the “URL” or “Network link” data type.

Example:

// In the note of the edit form, the function is written with parentheses
WEBFORM()
// In the name of an HTML control, it is written without parentheses; “WEBFORM()” has no effect there
WEBFORM
 

void /WEBFORM

Use: HTML control name – The body of the control must be left blank

Description: The function ends a block of controls that do not use a colored background in the left column with the control's name, and that use a reverse design – the controls do not have a frame, have a colored background, and display a colored bar below the control when focused.

Example:

/WEBFORM
 

void WRITEMESSAGE(string message)

Use: Script (where a comment is expected)

Description: The function prints the message specified by the “message” parameter immediately after the successful execution of the script. The text of the message can be entered in multiple languages. Unsafe HTML tags are removed from the message unless they are written directly in the function call – a message in which the administrator wrote them is printed unchanged, including the substituted values. The function cannot be used in the “OnBeforeSave” and “OnAfterSave” scripts.

Example:

WRITEMESSAGE(Script execution completed successfully.)
WRITEMESSAGE("Message, that contains a comma.")
 

void WRITEMESSAGE(string message, bool dialog)

Use: Script (where a comment is expected)

Description: The function prints the message specified by the “message” parameter immediately after the successful execution of the script, and also displays it in the dialog box. The text of the message can be entered in multiple languages. Unsafe HTML tags are removed from the message unless they are written directly in the function call – a message in which the administrator wrote them is printed unchanged, including the substituted values. The function cannot be used in the “OnBeforeSave” and “OnAfterSave” scripts.

Example:

WRITEMESSAGE(Script execution completed successfully., true)
WRITEMESSAGE("Message, that contains a comma.", true)
 

void WRITESITEMAP(string directory, string url)

void WRITESITEMAP(string directory, string url, string extraLanguages)

Use: Script (where a comment is expected)

Restriction: The function is not available in the NET Genium Online cloud edition.

Description: The function writes a sitemap.xml file for the website accessible at the URL specified by the “url” parameter to the directory on the server disk specified by the “directory” parameter (typically the root directory of the web application). The file contains the addresses of active web pages of all language versions, composed of the website URL, the language code and the page address; system web pages are not written to it, including all their child web pages, and neither are web pages under an inactive parent web page. A web page that redirects the visitor with the [[Alias:...]] tag is written under the address it redirects to – provided that it is a full address beginning with the website URL. Otherwise it is not written to the file, but its child web pages are. An alias to the identifier of the same web page and an alias on the web page with the identifier “search” are not considered a redirect. For a web page that has a record in the change history, the file contains the date of the last change. The optional “extraLanguages” parameter is a semicolon-separated list of language codes (e.g. “cs;en;de”) — for each of them, a separate file sitemap-language code.xml (e.g. sitemap-cs.xml) containing only the web pages of that language version is written in addition. The files are written in the background, so the script does not wait for the writing to finish, and an error during the writing is not reported to the user – it is only written to the “Errors” log. When the script is run in test mode, the function is not executed. The function reads the web pages from the “ng_webovastranka” table of the application for managing the web presentation; when run in a script of an edit form whose table name begins with “ng_webovastranka”, it reads the table of this form.

Example:

WRITESITEMAP(D:\inetpub\wwwroot\www.mycompany.com, https://www.mycompany.com)
// Writes the file D:\inetpub\wwwroot\www.mycompany.com\sitemap.xml
WRITESITEMAP(D:\inetpub\wwwroot\www.mycompany.com, https://www.mycompany.com, cs;en)
// Also writes the files sitemap-cs.xml and sitemap-en.xml
 

int YEAR(DateTime date)

Use: HTML, JavaScript, Script

Description: The function returns the year number from the date specified by the “date” parameter. For an invalid date, the function returns an empty string.

Example:

YEAR(15.2.2013)
// Returns “2013”
YEAR(#now#)