Available in sections: Code; Action Code; Select Code; Cell formatting cell, row, table.
=: select(table: ''; cycle: ; hash: ; field: ''; where: '' = ; order: '' asc)
Returns one value from the field
of the table
.
Required parameters
table β name-parameter table from which values are taken.
field β name-parameter field in the table
.
Optional parameters
cycle β defines the cycle if the table:
is calculated in a cycle.
table
is in a tree.hash β string, hash of the table to refer to the temporary table.
where β name-parameter condition for selecting a row in the row part. where: 'field' = "some_value"
β the left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.order
.order:
.Fields of types Select (multiple), Select-tree (multiple), and Data can be selected with the ==
comparison operator. In this case, an exact match is searched for, not an intersection of the field value with the value specified in where
.
Searching the Data field in simple tables may behave differently depending on whether the number-value is saved as a string or as a number.
If
*ALL*
is passed towhere
, thiswhere
will be disabled! This can be done through a separate line, for example:
=: select(table: 'table_name'; field: 'field_name'; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list of one value ["*ALL*"]
will be processed the same as "*ALL*"
.
order β name-parameter field in the table
by which sorting will be performed.
order
parameters are specified, sorting will be performed sequentially.sfield β name-parameter field of type Select or Select-tree, for which the display value needs to be selected and returned, not the base. sfield
is used instead of the field
parameter!
tfield β multiple, name-parameter field used for calculating select values in the requested sfield
fields.
offset β number skip the specified number of elements in the order defined in order
.
Example:
orders (cycle_id: 1)
id | order_number |
---|---|
1 | 98 |
2 | 99 |
3 | 100 |
example: select(table: 'orders'; cycle: 1; field: 'id'; where: 'order_number' = 100)
// Result: 3
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: selectList(table: ''; cycle: ; hash: ; field: ''; where: '' = ; order: '' asc)
Returns a list of values from the rows of the field
column in the table
table according to the sorting specified in order
.
Required parameters
table β name-parameter the table from which the values are taken.
field β name-parameter the field in the table
table.
Optional parameters
cycle β defines the cycle if the table
table is calculated in a cycle.
table
table is in a tree.hash β string, the hash of the table to get data from temporary tables.
where β name-parameter the condition for selecting a row in the row part. The left part defines the comparison field in the table
table, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.If
*ALL*
is passed inwhere:
, thiswhere
will be disabled! This can be done through a separate line, for example:
=: selectList(table: 'table_name'; field: 'field_name'; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list with a single value ["*ALL*"]
will be processed the same as "*ALL*"
.
order β name-parameter the field in the table:
table by which sorting will be performed.
order:
parameters are specified, sorting will be performed sequentially.sfield β name-parameter a field of type Select or Select-tree, for which the display value needs to be selected and returned, not the base. sfield
is used instead of the field
parameter!
tfield β multiple, name-parameter the field used to calculate the values of selects in the requested sfield
fields.
limit β number, limits the list to the specified number of elements.
0
or ""
is passed as the parameter value, it will be disabled!offset β number skips the specified number of elements according to the order
sorting.
Example:
orders
id | order_number |
---|---|
1 | 98 |
2 | 99 |
3 | 100 |
example: selectlist(table: 'orders'; field: 'id'; where: 'order_number' >= 99)
// Result: [2,3]
Available in sections: Code; Select Code.
=: selectRowListForSelect(table: ''; cycle: ; bfield: 'id'; field: ''; order: '' asc; where: '' = ; section: ''; preview: '')
Returns a special list of associative arrays for forming the display of Selects.
Required parameters
table β name-parameter the table from which values are taken.
field β name-parameter the field in the table
from which the display is taken.
Optional parameters
cycle β number, determines the cycle if the table
is a calculated in cycle table.
table
is in a tree.hash β string, hash of the table to get data from temporary tables.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.If
*ALL*
is passed towhere
, thiswhere
will be disabled! This can be done through a separate line, for example:
=: selectRowListForSelect(table: 'table_name'; field: 'field_name'; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list of one value ["*ALL*"]
will be processed the same way as "*ALL*"
.
order β name-parameter the field in the table
by which sorting will be performed.
order
parameters are specified, sorting will be performed sequentially.section β name-parameter, the field in the table
by which values will be grouped.
section
must contain single values.section
is a select, its displays will be used automatically, not the bases.preview β multiple, name-parameter multiple parameter, fields whose data is displayed in the panel when right-clicked or when a value is selected.
bfield β name-parameter the field that is output to the value
parameter of the final rowList.
bfield
is empty, id
is used as the key.previewscode β code for forming additional previews, receives the parameter $#val
, containing the bfield
of the select. Should return a rowlist in the format [{title: "", value: "", name: ""}].
non-row field values
and id
of the row, plus $#ntn
and $#nti
.Example 1:
clients
id | client |
---|---|
1 | Alexey |
2 | Pavel |
3 | Boris |
example1: selectRowListForSelect(table: 'clients'; field: 'client'; order: 'client' asc)
//Result:
//[
//{"value": 1, "is_del": false, "title":"Alexey"},
//{"value": 3, "is_del": false, "title":"Boris"}
//{"value": 2, "is_del": false, "title":"Pavel"}
//]
Example 2:
tax_payments_types
id | key | value |
---|---|---|
1 | 0 | General taxation system |
2 | 1 | Simplified taxation system (Income) |
3 | 2 | Simplified taxation system (Income minus Expense) |
4 | 3 | Unified tax on imputed income |
5 | 4 | Unified agricultural tax |
6 | 5 | Patent taxation system |
example2: selectRowListForSelect(table: 'tax_payments_types'; field: 'value'; bfield: 'key'; where: 'key' < 3; order: 'key' asc)
// Result:
// [
// {"value": 0, "is_del": false, "title":"General taxation system"},
// {"value": 1, "is_del": false, "title":"Simplified taxation system (Income)"}
// {"value": 2, "is_del": false, "title":"Simplified taxation system (Income minus Expense)"}
// ]
Available in sections: Code; Select Code.
=: selectRowListForTree(table: ''; cycle: ; field: ''; order: '' asc; where: '' = ; parent: ''; disabled: ; roots: )
Returns a list of associative arrays in the format:
{
"value": 35,
"is_del": false,
"title": "Production",
"parent": 1
}
Used to prepare data for the Select-tree field.
Required parameters
table β name-parameter table from which values are taken.
field β name-parameter field in the table
.
parent β name-parameter, field containing the bfield
value of the parent element or null if it is a top-level element.
Optional parameters
cycle β number, single or list, determines the cycle if the table
is calculated in a cycle.
hash β string, for temporary tables hash
of the table.
where β name-parameter, multiple, selection restriction in the form of where: 'field_name' = "some_value"
similar to selectList.
order β name-parameter, multiple, field by which sorting will be performed, and order in the form of 'field_name' asc
for ascending and 'field_name' desc
for descending.
disabled β numeric list, elements that are prohibited from selection but displayed in the tree.
bfield β name-parameter field in the table
that will be taken as the base. Default is id
.
roots β numeric list, elements that need to be placed at the first level of the tree. If used, the tree is built from them, indicating null
as their parent.
example: selectRowListForTree(table: 'tree'; field: 'title'; parent: 'parent_id')
// Result: [{"value":35,"is_del":false,"title":"Production","parent":null},{"value":45,"is_del":true,"title":"Material procurement and warehouse","parent":"35"} ]
Available in sections: Code; Action Code; Select Code; Cell formatting, row, table.
=: selectTreeChildren(table: ''; cycle: ; hash: ; id: ; parent: '')
Returns a list of ids that are children of the specified id
parameter, as well as children of children. The nesting level is not limited.
Required parameters
table β name-parameter table from which values are taken.
id β number, the row containing the element for which child rows are being searched.
parent β name-parameter, the field containing the ids of parent elements.
Optional parameters
cycle β number, id of the cycle if the table
is calculated in the cycle.
hash β string, hash of the table to get data from temporary tables.
bfield β name-parameter field in the table
. Default is 'id'
Example:
tree
id | title | parent_id |
---|---|---|
1 | System tables | null |
2 | Main | 1 |
3 | Accesses | 1 |
32 | Documentation | null |
33 | Settings | 32 |
example: selectTreeChildren(table: 'tree'; id: 1; parent: 'parent_id')
// Result: [2, 3]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: selectRow(table: ''; cycle: ; hash: ; fields: ; field: ''; field: ''; where: '' = ; order: '' asc)
Returns an associative array with keys as name of the fields specified in field
and values as their corresponding values. If the fields are in the row part, then from the first row of the row part according to the where
conditions and order
sorting. If the fields are from non-row parts, where
and order
are not applied.
Required parameters
Optional parameters
field β multiple, name-parameter field in the table
.
Supports specifying a key for the selected field: field: 'some_field' as "new_name"
cycle β defines the cycle if the table
is calculated in a cycle.
table
is in a tree.hash β string, hash of the table to get data from temporary tables.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part β the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.order
.If
*ALL*
is passed inwhere
, thiswhere
will be disabled! This can be done through a separate line, for example:
=: selectRow(table: 'table_name'; field: 'field_name'; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list with a single value ["*ALL*"]
will be processed the same as "*ALL*"
.
order β name-parameter field in the table
by which sorting will be performed.
order
parameters are specified, sorting will be done sequentially.sfield β multiple, name-parameter field of type Select or Select-tree, for which the display value needs to be selected and returned instead of the key. sfield
is used instead of the field
parameter!
Supports specifying a key for the selected field: sfield: 'some_field' as "new_name"
. In this usage, both the value and the display of the field can be selected simultaneously: field: 'some_field' as "f_value"; sfield: 'some_field' as "f_title"
.
tfield β multiple, name-parameter field used for calculating select values in the requested sfield
fields.
fields β list of field
fields.
You can pass a string value from the list as fields: "*ALL*"
:
*ALL*
β all fields of the row part.*HEADER*
β all header fields.*FOOTER*
β all footer fields.sfields β list of sfield
fields.
offset β number skip the specified number of elements according to the order
sorting.
Example:
clients
id | client | sum |
---|---|---|
1 | Alexey | 10 |
2 | Pavel | 20 |
3 | Boris | 30 |
example: selectrow(table: 'clients'; field: 'client'; field: 'sum'; order: 'id' desc)
// Result: {"client": "Boris", "sum": 30}
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: selectRowList(table: ''; cycle: ; hash: ; fields: ; field: ''; field: ''; where: '' = ; order: '' asc)
Returns a list of associative arrays.
Required parameters
Optional parameters
field β multiple, name-parameter field in the table
.
Supports specifying a key for the selected field: field: 'some_field' as "new_name"
cycle β number, single or list, determines the cycle if the table
is a calculated in cycle table.
hash β string, table hash to get data from temporary tables.
where β name-parameter, multiple, selection restriction in the form where: 'field_name' = "value"
.
order β name-parameter, multiple, field by which sorting will be performed, and order in the form order: 'field_name' asc
for ascending sorting and order: 'field_name' desc
for descending sorting.
tfield β name-parameter multiple, field used for calculating select values in the requested sfield
fields.
sfield β name-parameter multiple, field of type Select or Select-tree, for which you need to select and return the display value, not the base. sfield
is used instead of the field
parameter!
Supports specifying a key for the selected field: sfield: 'some_field' as "new_name"
. In this usage, it is possible to select both the value and the display of the field simultaneously: field: 'some_field' as "f_value"; sfield: 'some_field' as "f_title"
.
fields β list of field
fields.
You can pass a string value from the list in the form fields: "*ALL*"
:
*ALL*
β all fields of the row part.*HEADER*
β all header fields.*FOOTER*
β all footer fields.sfields β list of sfield
fields.
limit β number, limits the list to the specified number of elements.
0
or ""
as the parameter value, it will be disabled!offset β number skips the specified number of elements.
Example:
clients
id | client | sum |
---|---|---|
1 | Alexey | 10 |
2 | Pavel | 20 |
3 | Boris | 30 |
example: selectrowlist(table: 'clients'; field: 'client'; field: 'sum'; where: 'id' > 1; order: 'id' desc)
// Result:
// [
// {"client": "Boris", "sum": 30},
// {"client": "Pavel", "sum": 20},
// ]
Available in sections: Code; Action Code; Select Code; Cell formatting, row, table.
=: selectUnreadComments(users: json`[4,5,8]`; table: ''; field: ''; id: )
Returns information about unread comments from the comments field.
The result will be a rowlist
with a row for each user specified in users
:
The user is indicated in user
;
The number of unread comments in num
.
The comments themselves (unread) in comments
.
Mandatory parameters
field β name-parameter field in the table
.
table β name-parameter name of the table from which the data is taken.
users β list id
of users for whom to get comment data.
Optional parameters
cycle β number, determines the cycle if the table
is calculated in a cycle.
id β id
of the row if the request is to the row part.
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: nowDate(format: "Y-m-d H:i")
Returns the current date in the specified format.
Can be replaced with quick variables β $#nd
, $#ndt
, and $#ndts
.
Optional parameters
format β defines the format in which the date is displayed, for example Y-m-d H:i
format:
parameter is missing, the result will be a string in the format Y-m-d H:i
.Y-m-d H:i
and Y-m-d
.Can be specified as one string in which replacements will be made as a result of the function's operation:
Date format symbols
d
β Day of the month, 2 digits with leading zero from 01 to 31D
β Textual representation of the day of the week, 3 letters from Mon to Sun (not recommended to use as there is a function dateWeekDay
for this)j
β Day of the month without leading zero from 1 to 31N
β ISO-8601 numeric representation of the day of the week from 1 (Monday) to 7 (Sunday)z
β Day of the year from 0 to 365W
β ISO-8601 week number of year.m
β Numeric representation of a month with leading zero from 01 to 12M
β Short textual representation of a month, 3 letters from Jan to Dec (not recommended to use as there is a function X for this)n
β Numeric representation of a month without leading zero from 1 to 12t
β Number of days in the given month from 28 to 31L
β Whether it's a leap year 1 if it is a leap year, 0 otherwise.Y
β Full numeric representation of a year, 4 digits. Examples: 1999, 2003y
β Two digit representation of a year. Examples: 99, 03H
β 24-hour format of an hour with leading zero from 00 to 23i
β Minutes with leading zero from 00 to 59s
β Seconds with leading zero from 00 to 59example1: nowdate()
// Result: "2018-01-15 20:48"
example2: nowdate(format: "Y-m-d")
// Result: "2018-01-15"
example3: nowdate(format: "H:i")
// Result: "20:48"
example4: nowdate(format: "d.m.Y")
// Result: "15.01.2018"
example5: nowdate(format: "d.m.Y (H:00)")
// Result: "15.01.2018 (20:00)"
example6: nowdate(format: "z")
// Result: "15"
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: dateDiff(date: ; date: ; unit: "day|year|month|hour|minute")
Returns a number equal to the difference between date
and date
expressed in the unit
. If the second date is earlier than the first one, the function will return a negative value. The difference between the dates is returned as a fractional value.
Required parameters
date β two parameters must be specified.
unit β parameter defining the unit in which the difference is displayed.
example: dateDiff(date: $date1; date: $date2; unit: "day")
date1: "2017-07-01"
date2: "2017-07-02 10:42"
// Result: "1.4458333333333"
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: dateAdd(date: ; days: ; hours: ; minutes: ; months: ; years: ; format: "Y-m-d H:i"; lang: )
Adds days, hours, and minutes to a date and returns a new date (later than the specified one) as a single string. Specifying days, hours, and minutes with a negative sign will subtract them from the start date. The returned date will be earlier than the start date.
If adding months results in a non-existent date, the excess days are carried over to the next month.
Required parameters
date β the date to which the value will be added.
Optional parameters
format β defines the format in which the date is output, for example "Y-m-d H:i"
ATTENTION! THE DATE FIELD STORES THE VALUE IN THE FORMAT
"Y-m-d H:i"
and"Y-m-d"
.FOR CORRECT COMPARISON OPERATIONS, BOTH PARTS OF THE INEQUALITY MUST BE IN THE SAME FORMAT!
format:
parameter is absent, the result will be a string in the format "Y-m-d H:i"
.Can be specified as a single string in which replacements will be made as a result of the function's operation:
Date format symbols
d
β Day of the month, 2 digits with leading zero from 01 to 31.D
β Textual representation of the day of the week, 3 letters from Mon to Sun.j
β Day of the month without leading zero from 1 to 31.N
β ISO-8601 numeric representation of the day of the week from 1 (Monday) to 7 (Sunday).z
β The day of the year (starting from 0) from 0 through 365.W
β ISO-8601 week number of year.m
β Numeric representation of a month, with leading zeros from 01 to 12.M
β A short textual representation of a month, three letters from Jan to Dec.n
β Numeric representation of a month, without leading zeros from 1 to 12.t
β Number of days in the given month from 28 to 31.L
β Whether it's a leap year, 1 if it is a leap year, 0 otherwise.Y
β A full numeric representation of a year, 4 digits. Examples: 1999, 2003.y
β A two digit representation of a year. Examples: 99, 03.H
β 24-hour format of an hour with leading zeros from 00 to 23.i
β Minutes with leading zeros from 00 to 59.s
β Seconds with leading zeros from 00 to 59.F
β Full textual representation of a month.l (lowercase L)
β Full textual representation of the day of the week.lang β string, if not specified, the output is in the PHP language package on the server (English). If specified, then in the specified language. Supported languages:
ru
β Russian.es
β Spanish.de
β German.example: dateAdd(date: "2017-10-01 10:00"; days: 1; hours: 2; minutes: 20)
// Result: "2017-10-02 12:20"
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: dateFormat(date: ; format: "d.m.Y H:i"; lang: )
Returns the converted date as one string. If a list
or rowList
is passed in date
, the output will be a similar list
/rowList
with all appropriate replacements.
Required parameters
date β the date to be converted.
The passed value must match one of the formats:
Y-m-d
Y-m-d H:i
If passed without H:i
and converted to a format with H:i
, 00:00
is assigned.
format β defines the format in which the date is output, for example "Y-m-d H:i"
WARNING! THE DATE FIELD STORES THE VALUE IN THE FORMAT
Y-m-d H:i
andY-m-d
.FOR CORRECT COMPARISON OPERATIONS, BOTH PARTS OF THE INEQUALITY MUST BE IN THE SAME FORMAT!
format:
parameter is missing, the result will be a string in the format "Y-m-d H:i".Can be specified as a string in which replacements will be made as a result of the function's operation:
Date format symbols
d
β Day of the month, 2 digits with leading zero from 01 to 31.D
β Textual representation of the day of the week, 3 letters from Mon to Sun.j
β Day of the month without leading zero from 1 to 31.N
β ISO-8601 numeric representation of the day of the week from 1 (Monday) to 7 (Sunday).z
β The day of the year (starting from 0) from 0 through 365.W
β ISO-8601 week number of year.m
β Numeric representation of a month, with leading zeros from 01 to 12.M
β A short textual representation of a month, three letters from Jan to Dec.n
β Numeric representation of a month, without leading zeros from 1 to 12.t
β Number of days in the given month from 28 to 31.L
β Whether it's a leap year 1 if it is a leap year, 0 otherwise.Y
β A full numeric representation of a year, 4 digits. Examples: 1999, 2003.y
β A two digit representation of a year. Examples: 99, 03.H
β 24-hour format of an hour with leading zeros from 00 to 23.i
β Minutes with leading zeros from 00 to 59.s
β Seconds with leading zeros from 00 to 59.F
β Full textual representation of a month.l (lowercase L)
β Full textual representation of the day of the week.U
β Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).Optional parameters
lang β string, if not specified, the output is in the PHP language package on the server. If specified, it is in the specified language. Supported languages:
ru
β Russian.The following parameters apply if date
uses list
/rowList
:
keys β for rowList
, a list of keys in which the replacement will be made. If not specified, the replacement is made in all keys.
recursive β by default true
or list
specifying the levels of replacement 0
β top level, 1
β next nested level, and so on, for cases where replacement is needed at a specific level of nesting.
replace β can contain either a single element or a triple:
replace: "single-part"
β null
and ""
will be replaced with this value.
replace: "three-part" = "value"
β in this case, it checks the value and replaces only if it matches. It takes precedence over date formatting.
example: dateFormat(date: "01.07.2017"; format: "d.m")
// Result: "01.07"
example2: dateFormat(date: "01.07.2017"; format: "F"; lang: "ru")
// Result: "ΠΈΡΠ»Ρ"
example3: dateFormat(date: "26.03.2021"; format: "l"; lang: "ru")
// Result: "ΠΡΡΠ½ΠΈΡΠ°"
= : dateFormat(date: $rowlist; format: "d.Y"; keys: json`["format"]`)
rowlist: rowListCreate(field: "format" = $list; field: "out" = $list)
~list: listCreate(item: "2023-01-01"; item: "2023-01-02"; item: "2023-01-03")
// Result:
//[
// {
// "out": "2023-01-01",
// "format": "01.2023"
// },
// {
// "out": "2023-01-02",
// "format": "02.2023"
// },
// {
// "out": "2023-01-03",
// "format": "03.2023"
// }
//]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: dateIntervals(date: $#nd; num: 10; type: "hour|day|week|month"; datetime: false)
Returns a rowList
containing the keys start
and end
Required parameters
num β the number of intervals to generate.
type β specifies the type of interval:
"hour"
β hour"day"
β day"week"
β week"month"
β monthdate β the date to which the value will be added.
Optional parameters
format β determines the format in which additional formatted dates are output in the keys startf
and endf
.
Can be specified as one string in which replacements will be made as a result of the function's operation:
Date format symbols
d
β Day of the month, 2 digits with leading zeros from 01 to 31D
β Textual representation of the day of the week, 3 letters from Mon to Sun (not recommended to use as there is a function dateWeekDay
for this)j
β Day of the month without leading zeros from 1 to 31N
β ISO-8601 numeric representation of the day of the week from 1 (Monday) to 7 (Sunday)z
β The day of the year (starting from 0) from 0 to 365W
β ISO-8601 week number of yearm
β Numeric representation of a month, with leading zeros from 01 to 12M
β A short textual representation of a month, three letters from Jan to Dec (not recommended to use as there is a function X for this)n
β Numeric representation of a month, without leading zeros from 1 to 12t
β Number of days in the given month from 28 to 31L
β Whether it's a leap year, 1 if it is a leap year, 0 otherwise.Y
β A full numeric representation of a year, 4 digits. Examples: 1999, 2003y
β A two digit representation of a year. Examples: 99, 03H
β 24-hour format of an hour with leading zeros from 00 to 23i
β Minutes with leading zeros from 00 to 59s
β Seconds with leading zeros from 00 to 59datetime β true
if Y-m-d H:i
should be output in the keys start
and end
weekdaystart β specify the start day of the week for week
intervals in three-letter eng
format:
mon
tue
wed
thu
fri
sat
sun
Available in sections: Code; Action Code; Select Code; Cell, Row, Table Formatting.
=: round(num: ; type: ; step: ; decimals: )
Rounds a number in the desired direction with a given step to the specified number of decimal places.
Required parameters
Optional parameters
type β one string, rounding direction.
up
β rounding updown
β rounding downdecimals β one integer number, number of decimal places in the result of the function.
example: round(num: $limit; type: "up"; step: 0.25; decimals: 2)
limit: 3.56
// Result: 3.75
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: modul(num: )
Returns one number, the absolute value (modulus) of the number passed in num
.
Required parameters
example: modul(num: -3)
// Result: 3
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: numRand(min: ; max: )
Returns one number as a pseudo-random value in the range from min
(or 0) to max
(or the maximum possible random number in your PHP version).
Optional parameters
min β one number, the minimum boundary of the range for the random number.
max β one number, the maximum boundary of the range for the random number.
example: numRand(min: 0; max: 20)
// Result: 4
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row, Table.
=: numTransform(data: )
Within totum, all data is a string, but external systems sometimes specifically require numbers. This function converts strings to numbers.
If a list
or rowList
is passed in data
, the output will be a similar list
/rowList
with all appropriate replacements.
Required Parameters
The following parameters apply if a list
/rowList
is used in data
:
keys β for rowList
, a list of keys in which the replacement will be made. If not specified, the replacement is made in all keys.
recursive β by default true
or a list
specifying the levels of replacement: 0
β top level, 1
β next nested level, and so on, for cases where replacement is needed at a specific level of nesting.
EXAMPLES
example: numTransform(data: $transform)
transform: "5.87"
//Result:
= : numTransform(data: $rowlist; keys: json`["format"]`)
rowlist: rowListCreate(field: "format" = $list; field: "out" = $list)
~list: listCreate(item: "10500"; item: "10600"; item: "10700")
// Result:
//[
// {
// "format": 10500,
// "out": "10500"
// },
// {
// "format": 10600,
// "out": "10600"
// },
// {
// "format": 10700,
// "out": "10700"
// }
//]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strAdd(str: ; str: )
Returns a string formed by sequentially concatenating the specified strings. String concatenation.
Required parameters
example: strAdd(str: "Enjoy using "; str: "TOTUM")
// Result: "Enjoy using TOTUM"
This function has a sugar str
:
str: str`"#" + $#nfv ++ "β" ++ #field`
// Result: #34 β closed
+
β concatenates without a space.++
β concatenates, adding a space.Available in sections: Code; Action Code; Select Code; Cell, Row, Table Formatting.
=: strReplace(str: ; from: ; to: )
Searches in str:
for all direct occurrences of from
and replaces them with to
. Returns one string.
Required parameters
str β one string or number in which replacements will be made.
from β list or one string, the match that will be replaced.
to β list or one string to which the replacement will be made.
example1: strreplace(str: "Engines R3 and R5 in ignition mode"; from: "3"; to: "4")
// Result: "Engines R4 and R5 in ignition mode"
example2: strreplace(str: "Engines R3 and R5 in ignition mode"; from: "R"; to: "M")
// Result: "Engines M3 and M5 in ignition mode"
example3: strreplace(str: "Engines R3 and M5 in ignition mode"; from: $from; to: $to)
from: listcreate(item: "R3"; item: "M5")
to: listcreate(item: "S2"; item: "T7")
// Result: "Engines S2 and T7 in ignition mode"
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strRegMatches(str: ; template: ; matches: "matches"; flags: "u")
Returns true
or false
β matches the template.
Required parameters
template β one string PCRE (Perl-compatible regular expressions) template. WITHOUT DELIMITERS /png/
ββΊ png
Optional parameters
matches β one string name of the variable to which the found matches will be assigned
flags β PCRE flags. By default, u- utf-8
mode is passed.
example: if(condition: $reg = true; then: $#matches; else: "No match found")
reg: strRegMatches(str: "Sasha's car rustles with tires"; template: "\s+(tire[^\s]*)"; matches: "matches"; flags: "u")
// Result: [" tires","tires"]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strRegAllMatches(str: ; template: ; matches: "matches"; flags: "u")
Returns true
if there is one or more matches with the template in str
, otherwise false
.
Required parameters
template β one string PCRE (Perl-compatible regular expressions) template. WITHOUT DELIMITERS /png/
ββΊ png
Optional parameters
matches β one string name of the variable to which the found matches will be assigned
flags β PCRE flags. By default, u- utf-8
mode is passed.
Example:
Split text into lines and find the first word in each line
str Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
example: if(condition: $reg = true; then: $#matches; else: "No match found")
reg: strRegAllMatches(str: #str; template: "\s*([^\n ]+)[^\n]+(?:\n|$)"; matches: "matches"; flags: "mu")
// Result: [
// [
// "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem \n",
// "nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. \n",
// "Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit \n",
// "lobortis nisl ut aliquip ex ea commodo consequat."
// ],
// [
// "Lorem",
// "nonummy",
// "Ut",
// "lobortis"
// ]
// ]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: numFormat(num: ; decimals: ; decsep: ","; thousandssep: " "; unittype: )
Converts a number into a string formatted according to the template. If a list
or rowList
is passed in num
, the output will be a similar list
/rowList
with all appropriate replacements.
If a number in exponential notation
2,3e+15
comes from an external system, it is converted to the totum format using the numFormat function.The maximum size of a number processed by
numFormat
before the decimal point is 17 digits. If exceeded on a 64-bit machine, the final result will be a random number.
Required parameters
Optional parameters
decimals β number, the number of decimal places.
decsep β string, the decimal separator.
thousandssep β string, the thousands separator.
unittype β string, postfix.
prefix β string, prefix.
The following parameters apply if num
uses list
/rowList
:
keys β for rowList
, a list of keys in which the replacement will be made. If not specified, the replacement is made in all keys.
recursive β by default true
or a list
specifying the levels of replacement 0
β top level, 1
β next nested level, and so on, for cases where replacement is needed at a specific level of nesting.
replace β can contain either a single element or a tripartite:
replace: "single-part"
β null
and ""
will be replaced with this value.
replace: "three-part" = "value"
β in this case, it checks the value and replaces only if it matches. It takes precedence over date formatting.
example: numFormat(num: $num; decimals: 1; decsep: ","; thousandssep: " "; unittype: " r.")
num: 10000.34
// Result: "10 000,34 r."
= : numFormat(num: $rowlist; thousandssep: ","; unittype: " β¬"; keys: json`["format"]`)
rowlist: rowListCreate(field: "format" = $list; field: "out" = $list)
~list: listCreate(item: "10500"; item: "10600"; item: "10700")
// Result:
//[
// {
// "out": "10500",
// "format": "10,500 β¬"
// },
// {
// "out": "10600",
// "format": "10,600 β¬"
// },
// {
// "out": "10700",
// "format": "10,700 β¬"
// }
//]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strRandom(length: 5; numbers: "true|false|12345"; letters: "false|true|abcdABCD"; symbols: "false|true|!@#$%^&")
Returns a string of length length
, composed of the listed characters.
Required parameters
Optional parameters
numbers β one string, describing the use of numbers.
false
β do not use numbers.true
β use all numbers.12345
β use only numbers 12345.letters β one string, describing the use of letters.
false
β do not use letters.true
β use all letters of the English alphabet.abcdABCD
β use only the specified letters.symbols β one string, describing the use of symbols.
false
β do not use symbols.true
β use symbols !@#$%^&*()_+=-%,.;:!@#$%^&
β use only the specified symbols.example: strRandom(length: 5; numbers: "true"; letters: "true"; symbols: "true")
// Result: "z4yF9"
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strEncrypt(str: )
Returns an encrypted string.
To work, you need to create a
Crypto.key
file in the root of the installation (automatically generated during installation with random content) in which you enter the key that will be used to encrypt the string. The file must be created by the same linux user under which Totum is running.Attention: to decrypt the recorded data, an identical key will be required. Copy it if you transfer data to another server!
Mandatory parameters
Available in sections: Code; Action Code; Select Code; Cell formatting, row, table.
=: strDecrypt(str: )
Returns the decrypted string.
For it to work, you need to create a
Crypto.key
file in the root of the installation, in which you enter the key (created automatically during installation) that will be used to encrypt the string. The file must be created by the same Linux user under which Totum is running.Decryption is only possible with the key used during encryption.
Required parameters
strEncrypt
functionAvailable in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strUrlEncode(str: )
Returns a URL-encoded string.
Required parameters
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strUrlDecode(str: )
Returns the decoded string.
When receiving data in remotes, it is not required to apply β when receiving a URL-encoded string in
get
in remotes, it is automatically decoded.
Mandatory parameters
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strBaseEncode(str: )
Returns a string encoded in base64.
Required parameters
example: strBaseEncode(str: "row for crypt")
// Result: 0YHRgtGA0L7QutCwINC00LvRjyDQutC+0LTQuNGA0L7QstCw0L3QuNGP
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strBaseDecode(str: )
Returns the decoded base64 string or false
.
Attention! The result of decoding may be a string with non-utf-8
characters, which cannot be saved as a field value and will result in a database error if such an attempt is made!
Required parameters
example: strBaseDecode(str: "0YHRgtGA0L7QutCwINC00LvRjyDQutC+0LTQuNGA0L7QstCw0L3QuNGP")
// Result: string for encoding
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strLength(str: )
Returns a number β the length of str
.
Required parameters
example: strLength(str: "Totum")
// Result: 5
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strRepeat(str: ; num: )
Returns a string from str
, repeated num
times.
Required parameters
example: strRepeat(str: "-"; num: 5)
// Result: "-----"
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strSplit(str: ; separator: )
Returns a list of strings β str
split by separator
.
Required parameters
Optional parameters
limit β the maximum number of elements in the returned list.
Example:
str Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
example: strSplit(str: #str; separator: $#nl)
// Result:
// [
// "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem ",
// " nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. ",
// " Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit ",
// " lobortis nisl ut aliquip ex ea commodo consequat."
// ]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strTransform(str: ; to: "upper|lower|capitalize")
Returns the modified string.
Required parameters
str β the string to be modified.
to β the string, one of three values.
upper
β make all letters uppercase.lower
β make all letters lowercase.capitalize
β make the first letter of each word uppercase.example: strTransform(str: "elon musk"; to: "capitalize")
// Result: Elon Musk
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: textByTemplate(template: ; text: ; data: $data)
Returns html
.
Required parameters
Optional parameters
template β one string, name of the template in the table Print Templates.
Example:
id | Name template | type | styles | html |
---|---|---|---|---|
28 | kp | page | .title{font-size: 20px;}.text-main{font-size: 14px}.text-footer{padding-top: 20px; font-size: 14px} | <div class="title"> {title}</div><div class="text-main"> {text}</div><div class="text-footer"> {footer}</div> |
example: textByTemplate(template: "kp"; data: $data)
data: rowCreate(field: "title" = "Title"; field: "text" = "Text"; field: "footer" = "Footer")
// Result: "<style>.title{font-size: 20px;}.text-main{font-size: 14px}.text-footer{padding-top: 20px; font-size: 14px}</style><body><div class="title"> Title</div><div class="text-main"> Text</div><div class="text-footer"> Footer</div></body>"
example2: textByTemplate(text: $template; data: $data)
data: rowCreate(field: "title" = "Title"; field: "text" = "Text"; field: "footer" = "Footer")
```template:html
<div>Some text with {title}, {text} and {footer}</div>
```
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strMd5(str: )
Returns a string as an md5 hash.
Required parameters
example: strMd5(str: "0")
// Result: "15e79710ef30825afe1dc5c4d3fb5849"
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strGz(str: )
Returns the gz-compressed string str
.
Required parameters
example: set(table: 'testsimp'; field: 'file' = $fileList)
fileList: listCreate(item: $fileRow)
fileRow: rowCreate(field: "filestring" = $gz; field: "name" = "text.txt.gz")
gz: strGz(str: "Test row")
// In the file cell of the testsimp table β the file text.txt.gz
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strUnGz(str: )
Returns the unpacked gz-string str
or false
if the string could not be decoded.
Required parameters
example: strUnGz(str: $fileContent)
fileContent: fileGetContent(file: #gzfile[0]["file"])
// Result: unpacked text from the file
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: strPart(str: ; offset: ; length: )
Returns a part of the string passed to it.
Required parameters
Optional parameters
length β number, how many characters to take in the result.
If a negative number is specified, the end of the string will be counted from the end of the word.
offset β number, the offset of the selection (how many elements to shift the start).
If a negative number is specified, the start will be taken from the end of the string.
EXAMPLES
example_1: strPart(str: "7718767895"; length: 4; offset: 4)
//Result: "7678"
example_2: strPart(str: "-string-"; length: -1; offset: 1)
//Result: "string"
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: strTrim(str: )
Returns a string, trimming whitespace characters from the beginning and end of the string.
Required parameters
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listCreate(item: )
Creates a list from elements.
Optional multiple parameter
item β elements from which the list is created. The number of parameters determines the number of elements in the list.
example1: listCreate(item: 1; item: 2; item: 4; item: "")
// Result: [1,2,4,""]
example2: listCreate(item: "Alex"; item: "Sam"; item: "Mike")
// Result: ["Alex","Sam","Mike"]
example3: listCreate()
// Result: []
Available in sections: Code; Action Code; Select Code; Cell, Row, Table Formatting.
=: listMax(list: ; default: )
Returns the maximum value of a list. The result is a single value, except when the value specified in the default
parameter is returned.
Required parameters
list β a list of numbers, strings, dates, in which the maximum value is searched.
Optional parameters
default β the value returned by the function when an empty list is passed to list:
.
list
, the function will return ERR!
.
example1: listmax(list: $list1)
list1: listCreate(item: 35; item: 78; item: 13)
// Result: 78
example2: listmax(list: $list2)
list2: listCreate(item: "11"; item: "12"; item: "2")
// Result: 12
example3: listmax(list: $list3)
list3: listCreate()
// Result: "ERR!"
example4: listmax(list: $list4; default: 0)
list4: listCreate()
// Result: 0
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listMin(list: ; default: )
Returns the minimum value of a list. The result is a single value, except when the value specified in the default
parameter is returned.
Required Parameters
list β a list of numbers, strings, dates in which the minimum value is searched.
Optional Parameters
default β the value returned by the function when an empty list is passed to list:
.
list
, the function will return ERR!
.
example1: listMin(list: $list1)
list1: listCreate(item: 35; item: 78; item: 13)
// Result: 13
example2: listMin(list: $list2)
list2: listCreate(item: "11"; item: "12"; item: "2")
// Result: 2
example3: listMin(list: $list3)
list3: listCreate()
// Result: "ERR!"
example4: listmax(list: $list4; default: 0)
list4: listCreate()
// Result: 0
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listSum(list: )
Returns a single number, the sum of the values in the list
.
All elements of the list must be numeric values.
Required parameters
example: listsum(list: $list)
list: listCreate(item: 10; item: 5; item: 5)
// Result: 20
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listCount(list: )
Returns a single number, the count of elements in the list:
.
Required parameters
list β list, the elements of which are counted.
example1: listcount(list: $list1)
list1: listCreate(item: "Alex"; item: "Sam"; item: "Mike")
// Result: 3
example2: listcount(list: $list2)
list2: listCreate(item: 5; item: 10; item: 5)
// Result: 3
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listUniq(list: )
Returns a list of unique elements from the list
.
Required parameters
example: listuniq(list: $list)
list: listCreate(item: "Alex"; item: "Sam"; item: "Alex")
// Result: ["Alex","Sam"]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listItem(list: ; item: )
Returns one value from the list
at the position item
. The numbering of list elements starts from 0 (zero).
Can be replaced with the reference $list[item_number]
. More details on referencing a list element.
Required parameters
list β list from which the element is selected.
item β one number, the position of the list element.
example: listitem(list: $list2; item: 1)
list2: listCreate(item: "Alex"; item: "Sam"; item: "Alex")
// Result: "Sam"
example2: $list2_2[1]
list2_2: listCreate(item: "Alex"; item: "Sam"; item: "Alex")
// Result: "Sam"
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listJoin(list: ; str: )
Returns the values of a list or associated array joined into a string. str
is the string that is inserted between elements (glue).
Required parameters
Optional parameters
example: listJoin(list: $list; str: "-")
list: listCreate(item: 1; item: 2; item: 3)
// Result: "1-2-3"
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listCross(list: ; list: )
Returns a list of values containing all values from the first list that are present in all subsequent lists. Any number of lists can be specified for intersection search.
Mandatory parameters
example: listcross(list: $list1; list: $list2; list: $list3)
list1: listCreate(item: 1; item: 1; item: 2; item: 3)
list2: listCreate(item: 1; item: 2; item: 3)
list3: listCreate(item: 1; item: 2)
// Result: [1, 1, 2]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listAdd(list: ; list: ; item: )
Combines lists in the specified order and returns a list. Any number of lists can be specified, which will be combined together. Values in the lists may repeat.
Required multiple parameters
list β the lists to be combined, a multiple parameter.
Optional multiple parameters
item β single value that can be added to the list, a multiple parameter.
example: listadd(list: $list1; list: $list2; item: 5)
list1: listCreate(item: 1; item: 2; item: 3)
list2: listCreate(item: 2; item: 3)
// Result: [1,2,3,2,3,5]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listMinus(list: ; list: ; item: )
Returns a list. Subtracts from the first list the values contained in the subsequent lists and individual values. Any number of lists and individual values can be specified.
Required multiple parameters
At least two parameters must be present, the first of which is list
.
Optional multiple parameters
item β a value that will be excluded from the list, multiple parameter.
example: listminus(list: $list1; list: $list2; item: 2)
list1: listCreate(item: 1; item: 2; item: 2; item: 3; item: 4)
list2: listCreate(item: 3; item: 4; item: 5)
// Result: [1]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listCut(list: ; cut: "first|last"; num: 1)
Returns a list reduced by num
elements from the beginning or the end.
Required parameters
cut β string, the side from which elements will be removed.
first
β from the beginning.last
β from the end.Optional parameters
num β number, the number of elements to remove, default is 1
.
cut: "first"
is passed with -1
, the last value of the list will remain.example: listCut(list: $list; cut: "first"; num: 1)
list: listCreate(item: 1; item: 2)
// Result: [2]
//Get the number of the last key in the list
= : listCut(list: $keys; cut: "first"; num: -1)
keys: rowKeys(row: $list)
list: listCreate(item: "10500"; item: "10600"; item: "10700")
// Result: [2]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listSection(list: ; item: )
Returns a list of values for the specified item:
key based on the associative array.
Can be replaced with an expression like $rowList[[key]]
. For more details, see section reference.
Required parameters
list β an associative array or list from which the column will be taken.
item β the key whose values are selected; for lists, the key is numeric.
Example 1:
tree
id | title |
---|---|
1 | System Tables |
2 | Main |
3 | Access |
32 | Documentation |
example1: listSection(list: $rowList; item: "id")
rowList: selectRowList(table: 'tree'; field: 'id'; field: 'title'; order: 'id' asc)
// Result: [1, 2, 3, 32]
Example 2:
example2: listSection(list: $listList; item: 1)
listList: json`[[1,2,3],[4,5,6]]`
// Result: [2,5]
Since listSection
is used quite often, the syntax provides a quick reference to the section via $name[[section]]
:
example3: $listList[[1]]
listList2: json`[[1,2,3],[4,5,6]]`
// Result: [2,5]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: listFilter(list: $list; key: "key|value|item" ><!= ; item: ""; regexp: ; skip: ; matches: )
Returns a list or associative array of elements that match the filtering conditions.
If a list is passed in
list
, the result is a new list with keys numbered from 0. For an associative array, the keys are preserved.
Required Parameters
list β a list or associative array in which the filtering is performed.
key β an expression consisting of the type of the compared element, a comparison operator, and a value for comparison, a multiple parameter in the syntax key: "item_name" ><!= "some_value" num
.
key
β filtering rows by keys
of the list or row.value
β filtering rows by value.item
β for lists associative arrays, filtering rows by the value in the column defined in item
.You can use the parameter in the following syntax:
=: listFilter(list: $list; key: "item_name" ><!= "some_value")
This entry is equivalent to:
=: listFilter(list: $list; key: "item" ><!= "some_value"; item: "item_name")
Also, in this case, a third element str
or num
can be used to define the data type in item_name
:
In this case, the data in item_name will be processed as strings:
=: listFilter(list: $list; key: "item_name" >= "40" str)
Also, in this syntax, key
is a multiple parameter β the result of filtering by the intersection of boundary conditions.
Optional Parameters
item β in the case when the compared element in key
is chosen as item
β you need to pass the key of this item
here.
regexp β true
or a set of flags, in case the right part of key
is a regular expression. By default, the flag is set to u
.
skip β true
, if item
is used in key
and it may be absent in the filtered subarrays, then skip elements in which it does not exist. Otherwise, the function will terminate with an error.
matches β the name of the variable in which the list of matches of the selected rows will be recorded. Used to save matches that meet the filtering condition when regexp: true
is enabled, in the specified variable. For example, in the code =: listFilter(list: $list; key: "t" = "tree"; regexp: true; matches: "matches_list")
in addition to returning the filtered rows, the result of the regular expression matches will be saved in the variable matches_list
.
savekeys β by default, the filtered list has its own key numbering, but if you pass true
β the original keys will be preserved.
example1: listFilter(list: $list; key: "item" = "tree"; item: "t")
list: listCreate(item: $row_1; item: $row_2)
row_1: rowCreate(field: "t" = "pen"; field: "i" = 1)
row_2: rowCreate(field: "t" = "tree"; field: "i" = 2)
// Result:
// [
// {
// "i": 2,
// "t": "tree"
// }
// ]
example2: listFilter(list: $list; key: "t" = "tree")
list: listCreate(item: $row_1; item: $row_2)
row_1: rowCreate(field: "t" = "pen"; field: "i" = 1)
row_2: rowCreate(field: "t" = "tree"; field: "i" = 2)
// Result:
// [
// {
// "i": 2,
// "t": "tree"
// }
// ]
example3: listFilter(list: $list; key: "i" < "2" str)
list: listCreate(item: $row_1; item: $row_2)
row_1: rowCreate(field: "t" = "pen"; field: "i" = 10)
row_2: rowCreate(field: "t" = "tree"; field: "i" = 50)
// Result:
// [
// {
// "i": 10,
// "t": "pen"
// }
// ]
Available in sections: Code; Action Code; Select Code; Cell, Row, Table formatting.
=: listSearch(list: $list; key: "value|item" ><!= ; item: "")
Returns a list of keys that match the search conditions by values or nested values.
Required parameters
list β a list or an associative array or a list of associative arrays.
key β an expression in the form key: "type" ><!= "some_value"
, defining the selection range, a multiple parameter in the syntax key: "item_name" ><!= "some_value" str
.
value
β the search is performed on the entire value.
=
will search for intersections in the associative arrays, and ==
will search for exact matches without considering the order.item
β the search is performed on the nested value for a list of associative arrays.
You can use the parameter in the following syntax:
=: listSearch(list: $list; key: "item_name" ><!= "some_value" str)
This entry is equivalent to:
=: listSearch(list: $list; key: "item" ><!= "some_value"; item: "item_name")
item_name_2 will be sorted by type string
Also, in this syntax, key
is a multiple parameter β the result of the search by the intersection of boundary conditions.
Additionally, you can specify the element str or num in key to indicate the type of sorting.
Optional parameters
key
is item
β you need to pass the name of this item
here.If the list contains an element without the item
key, an error will be returned!
example1: listSearch(list: $list; key: "item" = "tree"; item: "t")
list: listCreate(item: $row_1; item: $row_2)
row_1: rowCreate(field: "t" = "pen"; field: "i" = 1)
row_2: rowCreate(field: "t" = "tree"; field: "i" = 2)
// Result: [1]
example2: listSearch(list: $list; key: "t" = "tree")
list: listCreate(item: $row_1; item: $row_2)
row_1: rowCreate(field: "t" = "pen"; field: "i" = 1)
row_2: rowCreate(field: "t" = "tree"; field: "i" = 2)
// Result: [1]
example3: listSearch(list: $list; key: "i" < "2" str)
list: listCreate(item: $row_1; item: $row_2)
row_1: rowCreate(field: "t" = "pen"; field: "i" = 10)
row_2: rowCreate(field: "t" = "tree"; field: "i" = 5)
// Result: [0]
Available in sections: Code; Action Code; Select Code; Cell, Row, Table Formatting.
=: listSort(list: ; type: "number|string|regular"; direction: "asc|desc"; key: "key|value|item"; item: "")
Returns a sorted list
.
Attention: sorting of special characters in PHP (listSort) and PostgreSQL (parameters
order
inselect-functions
) DIFFERS! Full comparison in this case will returnfalse
. For full functionality in such cases, do not performorder
inselect
, but add anotherlistSort
.
Required parameters
list β list or associative array to be sorted.
If a list is passed in
list
, the result is a new list with keys numbered from 0; for an associative array, keys are preserved.
Optional parameters
type β string, the type to which the sorted elements are cast during comparison.
number
β number.string
β string.regular
β without casting. The result is unpredictable with heterogeneous content.nat
β sorting by number after the same prefix n15
, n16
, n17
, ...
This setting is global β it applies to all keys used in the function.
Instead, you can use the fourth element str or num in key to specify the sort type:
=: listSort(list: $list; key: "item_name_1" asc num; key: "item_name_2" desc str)
item_name_1 will be sorted by type number
item_name_2 will be sorted by type string
asc num and num asc will work similarly
direction β string, the sort direction.
asc
β ascending (default).desc
β descending.key β an expression of the type of the compared element, the comparison operator, and the value for comparison.
key
β sorting rows by keys
of the list or row.value
β sorting rows by value.item
β for lists associative arrays, sorting rows by the value in the column specified in item
.It is possible to use the parameter in this syntax:
=: listSort(list: $list; key: "item_name_1" asc; key: "item_name_2" desc)
item_name_1 and item_name_2 will be sorted by type regular
if type is set, it will be applied to all keys
if direction is set, it will be applied to all keys without a specified direction
Also, in this syntax, key
is a multiple parameter β the result of sorting by sequential application from left to right.
example1: listSort(list: $list; type: "string"; direction: "asc")
list: listCreate(item: 1; item: 2; item: 11; item: 21)
// Result: [1,11,2,21]
example2: listSort(list: $list; key: "numbers" desc num)
rowlist: rowListCreate(field: "numbers" = $list_numbers; field: "name" = $list_name)
list_numbers: listCreate(item: 1; item: 2; item: 11; item: 21)
list_name: listCreate(item: "Alex"; item: "Mike"; item: "Sam"; item: "Dany")
// Result: [{"numbers":"21","name":"Dany"},{"numbers":"11","name":"Sam"},{"numbers":"2","name":"Mike"},{"numbers":"1","name":"Alex"}]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: listMath(list: ; num: ; list: ; operator: )
Returns a list
where all elements have been modified according to the operator
and num
.
Required parameters
list β list or associative array, the source.
num β number for the arithmetic operation.
or
list β list or associative array (depending on the format of the first list
), for pairwise arithmetic operations. The number of elements in the list
must be the same (for associative arrays, the set of keys must be the same).
operator β string, the mathematical operator.
+
β add-
β subtract*
β multiply/
β divideexample1: listMath(list: $list; num: 3; operator: "*")
list: listCreate(item: 1; item: 2; item: 11; item: 21)
// Result: [ 3, 6, 33, 63]
example2: listMath(list: $list1; list: $list2; operator: "*")
list1: listCreate(item: 1; item: 2; item: 11; item: 21)
list2: listCreate(item: 1; item: 2; item: 1; item: 1)
// Result: [ 1, 4, 11, 21]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: listTrain(list: )
Returns a list of sequentially joined lists nested within lists.
Required parameters
example: listTrain(list: $lists)
lists: json`[[1,2],[3,4],[5,6]]`
//Result: [1,2,3,4,5,6]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row, Table.
=: listRepeat(item: ; num: )
Returns a list of the item
repeated num
times.
Required parameters
num β number, the number of times the item:
is repeated.
item β a value of any type.
example: listRepeat(item: $row; num: 2)
row: rowCreate(field: "test" = 1)
// Result: [
// {
// "test": 1
// },
// {
// "test": 1
// }
// ]
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: listNumberRange(min: ; max: ; step: 1)
Returns a list of numbers in the specified range, incremented by step
Optional parameters
min β number from.
max β number to (the end value is not included in the interval).
step β number, step.
step
> 0
β in order from min
inclusive to max
exclusive.step
< 0
β in order from max
inclusive to min
exclusive.step
= 0
β ERR!
example1: listNumberRange(min: 1; max: 3; step: 0.5)
// Result: [1,1.5,2,2.5]
example2: listNumberRange(min: 1; max: 3; step: -0.5)
// Result: [3,2.5,2,1.5]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: listCheck(list: )
Returns true
if a list, row, or rowlist is passed in list
. Returns false
only if a single value is passed!
Required parameters
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: listReplace(list: ; action: "item" = $val; action: $val; key: "key"; value: "value")
Iterates through the list sequentially. Can be used for:
creating a list/associative array based on the original with value replacements.
creating a list of associative arrays/associative array/associative arrays based on the original with replacement of individual elements of nested arrays.
performing actions based on the original list/associative array.
WARNING! The function does not use recursion, and you can use it when encountering a stack overflow error.
Required parameters
list β list, list of associative arrays or associative array.
action β multiple parameter, the action to be performed:
action: $act
β
action: "key" = $act
β
Optional parameters
value β string, a variable to which the value will be passed in the case of a list and row in the list of associative arrays.
key β string, a variable to which the ordinal number of the processed element β value or row β will be passed.
replace: listReplace(list: $rowlist; action: "date" = $weekDay; action: "max_temp" = $max_temp; value: "val")
rowlist: rowListCreate(field: "date" = $list_date)
list_date: listCreate(item: "2020-09-10"; item: "2020-09-11"; item: "2020-09-12")
weekDay: dateFormat(date: $#val[date]; format: "l"; lang: "ru")
max_temp: listMax(list: $day_temp; default: "")
day_temp: selectList(table: 'temp'; field: 'temp'; where: 'date' = $#val[date])
// Iterates through the list of associative arrays in the date column where dates are stored.
// Sequentially in each row, it rewrites the date to the textual representation of the day of the week.
// Sequentially in each row, it adds the max_temp key by calculating the maximum temperature on that day based on data taken at each iteration from the temp table by the date key value in that row.
replace_act: listReplace(list: $list_date_act; action: $recalc; value: "val_act")
list_date_act: listCreate(item: "2020-09-10"; item: "2020-09-11"; item: "2020-09-12")
recalc: recalculate(table: $#ntn; where: 'date' = $#val_act)
// Executed in the action code, it will sequentially recalculate the rows of the current table where the date equals the dates from list_date_act.
Additional explanations
listReplace is simpler than everyone thinks. It processes the list specified in the list
parameter from start to finish. If a list of 5 values is input, the output will be a list of 5 values.
How values are changed. They are changed in the action
parameters.
If we have a list [1,5,16,4]
as input (for example, these are some id
s and we need to find the corresponding names for them), it will be like this: action: $value
and in the value
line, there will already be a search for this item for each row.
Example:
=: listReplace(list: json`[1,5,16,4]`; action: $val; value: "row")
val: select(table: 'test_projects'; field: 'nr_name'; where: 'id' = ?)
I have left a question mark in the where
clause to explain the value
parameter. The thing is, when we perform a search in the val
line, we need to compare it with the initial value we have in the processed list. This value is passed to the variable, the name of which we set in the value
parameter. Why do we set it ourselves? Because we might have 10 different listReplace in one code, and they should have different variables. The variable is called as usual $#value_name
. In my example, $#row
.
I named it row
because, in reality, this variable sequentially receives the values of each processed row in the order they are in the source list in the list
parameter.
In my example, at step 2 (numbering starts from 0): $#row
= 16
.
And what if we have not a list
but a rowlist
as input? In this case, it will be the entire row, for example: {"name":"Alex","id":10}
Then if we have a list
as input, the comparison will be where: 'id' = $#row
, and if we process a rowlist
, then where: 'id' = $#row[id]
(we need to specify from which column of the rowlist
to take the comparison).
Example for list
:
=: listReplace(list: json`[1,5,16,4]`; action: $val; value: "row")
val: select(table: 'test_projects'; field: 'nr_name'; where: 'id' = $#row)
Now let's see what action: "item" = $val
is β this thing is for processing rowlist
. That is, when we have a rowlist
as input and we want to replace the value only in one of its columns or add a new column, then this option is used.
Example with rowlist
:
=: listReplace(list: #some_rowlist; action: "second_name" = $val; value: "row")
val: select(table: 'test_projects'; field: 'nr_name'; where: 'id' = $#row[id])
In this example, it will add a column second_name
to each row in my rowlist
: {"name":"Alex","id":10; "second_name":"Some found name"}
. It searches for this second_name
for each row by the key id
.
So, action: $val
means replacing the entire value of the row with a new one, while action: "second_name" = $val
means changing one column or adding a new one. The latter obviously works only if the input is rowlist
.
If the input is rowlist
, you can have multiple action: "item_1" = $val_1; action: "item_2" = $val_2
.
But can you have multiple action: $val
for an incoming list
? Yes, but only in action codes, because in action codes these will be executable actions. If it's just in the code, it becomes absurd, as the subsequent action
will overwrite the previous one.
What is key
? If value
passes the value of the row being processed at the step, then key
passes its number (list numbering starts from 0). For the list [1,5,16,4]
, when processing the row with the value 16
, the variable in key
will be ... 2
.
Why is this needed? The fact is that you can feed not only list
and rowlist
but also row
into list
.
For example, we have such a row
: {"490":"Alex","520":"Mike","530":"John"}
and we want to add *
for all those whose keys are greater than 500
(for example, this is the number of loyalty points):
=: listReplace(list: json`{"490":"Alex","520":"Mike","530":"John"}`; action: $val; key: "key"; value: "value")
val: if(condition: $#key > 500; then: str`$#value ++ "*"`; else: $#value)
Note that the new value is assigned at each step β listReplace does not skip anything, but if we do not need to change the value at the step, we can assign the new one without changing from $#value
!
That's all!
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: rowCreate(field: "" = )
Returns an associative array with keys as name of the fields specified in field:
and values specified after =
.
Optional multiple parameter
field β multiple parameter, elements from which the array is created. The number of field
parameters determines the number of elements in the array.
example: rowCreate(field: 'name' = "Alexey"; field: 'age' = 35)
//Result: {"name": "Alexey", "age": 35}
Available in sections: Code; Action Code; Select Code; Cell, Row, Table Formatting.
=: rowListCreate(field: "" = $list)
Returns a list of associative arrays with keys in the form of field names specified in field
and values specified after =
. Rows are created in the order of sorting of the lists passed in field
.
Required parameters
field β multiple parameter, elements from which a list of associative arrays is created. The number of field
parameters determines the number of elements in the array.
example: rowlistCreate(field: 'name' = $names; field: 'age' = $ages)
names: listCreate(item: "Alexey"; item: "Pavel")
ages: listCreate(item: 32; item: 35)
// Result:
// [
// {"name": "Alexey", "age": 32},
// {"name": "Pavel", "age": 35}
// ]
Available in sections: Code; Action Code; Select Code; Cell, Row, Table Formatting.
=: rowCreateByLists(keys: $keysList; values: $valuesList)
Returns an associative array or false
.
Required parameters
keys β a list containing strings or numbers that will become the keys for the array.
values β a list containing any data that will become the values.
The sizes of the keys
and values
lists must match.
example: rowCreateByLists(keys: $keysList; values: $valuesList)
keysList: listCreate(item: "min"; item: "middle"; item: "max")
valuesList: listCreate(item: "cherry"; item: "apple"; item: "watermellon")
// Result: {"min":"cherry", "middle": "apple", "max": "watermellon"}
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: rowAdd(row: ; row: ; field: "" = )
Returns an associative array, supplemented and corrected by subsequent row
and field
.
Required parameters
row β associative array that will be supplemented or modified.
Optional parameters
field β elements that will be added to the end of the array in the specified order. The first element of the expression is the base field: "base" = $value
.
$value
can be specified as single values and lists of numbers, strings, dates, and boolean values.path β a list of keys that shows where in the row structure the data should be inserted.
replace β true
. Used only in conjunction with path
, to completely replace the key value rather than adding values.
example: rowAdd(row: $row1; field: "test2" = "2"; field: "test3" = "3")
row1: rowCreate(field: "test1" = "1"; field: "test2"="1")
// Result:
// {
// "test1": "1",
// "test2": "2",
// "test3": "3"
// }
// example_data
// {
// "data": [
// {
// "num": "some num 1",
// "value": "some value 1",
// "product": {}
// },
// {
// "num": "some num 1",
// "value": "some value 1",
// "product": {}
// }
// ]
// }
example2: rowAdd(row: #example_data; field: "test2" = "2"; field: "test3" = "3"; path: $list)
list: listCreate(item: "data"; item: 0; item: "product")
// {
// "data": [
// {
// "num": "some num 1",
// "value": "some value 1",
// "product": {
// "test2": "2",
// "test3": "3"
// }
// },
// {
// "num": "some num 1",
// "value": "some value 1",
// "product": {}
// }
// ]
// }
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: rowListAdd(rowlist: ; rowlist: ; field: "" = ; field: "" = )
Returns a list of associative arrays, supplemented and corrected by subsequent rowList
and field
.
Required parameters
rowlist β lists of associative arrays that will be combined, multiple parameter.
Optional parameters
field β columns that will be added to the array in the specified order. Bases are specified in double quotes field: "base" = $value
. Multiple parameter.
example: rowListAdd(rowlist: $rowList1; rowlist: $rowList2; field: "test" = 1; field: "testlist" = $valListl; field: "test2" = 0)
rowList1: jsonExtract(text: '[{"test1":1,"test2":1}, {"test1":2,"test2":2}, {"test1":3,"test2":3}]')
rowList2: jsonExtract(text: '[{"test10":10}, {"test10":20}, {"test10":30}]')
valListl: jsonExtract(text: '[5, 6, 7]')
// Result: [
// {
// "test": 1,
// "test1": 1,
// "test2": 0,
// "test10": 10,
// "testlist": 5
// },
// {
// "test": 1,
// "test1": 2,
// "test2": 0,
// "test10": 20,
// "testlist": 6
// },
// {
// "test": 1,
// "test1": 3,
// "test2": 0,
// "test10": 30,
// "testlist": 7
// }
// ]
Available in sections: Code; Action Code; Select Code; Cell, Row, Table formatting.
=: rowKeys(row: )
Returns a list of keys from an associative array.
Required parameters
example: rowKeys(row: $row)
row: rowCreate(field: "test1" = "1"; field: "test2" = "1")
// Result: [
// "test1",
// "test2"
// ]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: rowValues(row: )
Returns the values of the given associative array.
Required parameters
example: rowValues(row: $row)
row: rowCreate(field: "test1" = "1"; field: "test2" = "1")
// Result:
// [
// "1",
// "1"
// ]
Available in sections: Code; Action Code; Select Code; Cell, Row, Table Formatting.
=: rowKeysReplace(row: ; from: ; to: ; recursive: false)
Returns an associative array with keys replaced from from
to to
.
Required parameters
row β list or associative array in which keys will be replaced.
from β single or list of strings that will be searched for in the array keys.
to β single or list of strings that will replace matches from from
in the array keys.
If lists are passed in from
and to
, replacements will be made pairwise.
Optional parameters
recursive β check nested keys for lists of associative arrays.
true
β search inside.false
β do not search (default)."3"
β search inside at the specified level. It can also be passed as a list
. Levels are numbered from 0
β top level, first nesting β 1
, etc.example: rowKeysReplace(row: $rowList; from: "a"; to: "c"; recursive: true)
rowList: jsonExtract(text: '[{"a": 1, "b": 2}, {"a": 4, "d": 4}]')
// Result: [{"c": 1,"b": 2},{"c": 4,"d": 4}]
Available in sections: Code; Action Code; Select Code; Cell, Row, Table formatting.
=: rowKeysRemove(row: ; key: ; keys: ; recursive: false)
Returns an associative array with removed keys (columns) key
or keys
.
Required parameters
Optional parameters
key β string, name-key (column) to be removed, multiple parameter.
recursive β check nested keys for lists of associative arrays.
true
β search inside.false
β do not search (default)."3"
β search inside at the specified level. It can also be passed as a list
. Levels are numbered from 0
β top, first nesting β 1
, etc.example: rowKeysRemove(row: $rowList; key: "a"; recursive: true)
rowList: jsonExtract(text: '[{"a": 1, "b": 2}, {"a": 4, "d": 4}]')
// Result: [{"b": 2},{"d": 4}]
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: if(condition: ; then: ; else: )
Returns the value of the then
section if the condition
is true, otherwise returns the value of the else
section or null
if it is not specified.
Required parameters
condition β the triggering condition in the form condition: "left_part" = "right_part"
.
condition
evaluates to false
, neither the subsequent conditions nor the then
section will be calculated.Optional parameters
At least one of them must be present for the function to work correctly.
then β the value or reference to a row or parameter that will be calculated if all condition
evaluate to true
.
else β the value or reference to a row or parameter that will be calculated if at least one condition
evaluates to false
.
example1: if(condition: $test1 = 1; condition: $test11 = 2; then: true; else: false)
test1: 1
test11: 3
// Result: false
example2: if(condition: $p1_2 < $p2_2; condition: $p2_2 < $p3_2; then: "Start"; else: "Stop")
p1_2: 10
p2_2: 20
p3_2: 30
// Result: "Start"
example3: if(condition: $p1_3 > $p2_3; then: true)
p1_3: 10
p2_3: 20
// Result: ""
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: while(preaction: ; condition: ; limit: ; action: ; postaction: ; iterator: )
Performs action
if condition
is met with a repetition count of limit
, changing iterator
by +1 in each iteration. Returns the value of the last preaction|action|postaction
depending on their presence in the function.
Optional parameters
preaction β code string value, an action performed in any case before processing the condition
sections and iterations.
preaction
besides the action or together with it (depends on the [action function][24]) returns a value if there are no subsequent action
, postaction
or they are not executed according to the condition
.limit β number, the maximum number of iterations if condition
in each iteration passes as true.
condition β a triggering condition of the form condition: "left_part" = "right_part"
.
condition
is false
, the subsequent condition
, action
, and subsequent operations will not be executed.action β code string value, an action performed inside the iteration. Repeats in each iteration.
action
besides the action or together with it (depends on the [action function][24]) returns a value.postaction β code string value, executed after all iterations. Provided that at least one action
is executed!
action
besides the action or together with it (depends on the [action function][24]) returns a value.iterator β iteration number counter.
while
with iterators in one code section.example: while(action: $set1; action: $set2)
set1: set(table: 'table1'; field: 'field1' = 1)
set2: set(table: 'table2'; field: 'field2' = 2)
// Result: Assigns the values 1 and 2 to the fields field1 and field2 in tables table1 and table2 respectively.
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: var(name: ""; value: ; default: )
Stores and returns the value of a variable within the code section of a specific field.
Required Parameters
name β one string, the name of the variable used to access the data.
name
does not repeat and does not overlap with values of other variables within the code.Optional Parameters
value β the value assigned to the variable and returned by the function.
default β assigns a value to the variable once during the execution of the code section if it is not defined when accessed.
example1: while(action: $set; limit: 30; iterator: "iter1")
set: var(name: "count"; value: $plus)
plus: listAdd(list: $var; item: $i)
var: var(name: "count"; default: $#lc)
i: dateAdd(date: $#nd; days: $days)
days: $#iter1 * -1
example2: while(preaction: $zero2; action: $set2; limit: 30; iterator: "iter2")
zero2: var(name: "count"; value: $#lc)
set2: var(name: "count"; value: $plus2)
plus2: listAdd(list: $#count; item: $i2)
i2: dateAdd(date: $#nd; days: $days2)
days2: $#iter2 * -1
example3: $while{var: "count" = $#lc}
while: while(action: $set3; limit: 30; iterator: "iter3")
set3: var(name: "count"; value: $plus3)
plus3: listAdd(list: $#count; item: $i3)
i3: dateAdd(date: $#nd; days: $days3)
days3: $#iter3 * -1
In Totum logic, it is significantly more efficient to use recursions or the listReplace function, which processes lists row by row, instead of loops.
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: globVar(name: ""; value: ; default: ; date: ; block: )
Saves and returns the value of a variable globally, independent of transactions. Short reference @$name_glob_var
The recording occurs outside the transactional model at the moment the function is called with the
name
andvalue
parameters.
Required parameters
Optional parameters
value β the value assigned to the variable and returned by the function.
null
.date
.default β works only in the absence of the value
parameter, assigns a value to the variable if it is undefined when accessed. Calculated at the start of the function in any case.
date
if it was not present.date β works with any set of optional parameters.
true
- the function returns a structure like {"date": "2024-07-19 13:19:47","secpart": "303308","value": "some value"}
block β number
in seconds or false
. Used only if there is no value
, only when requesting the variable. Allows setting a request lock for another process, which will wait until the lock expires.
Designed for use in concurrent processes that check and change the variable's value. For example, if false
, set true
and upon process completion change it to false
. If true
, do nothing. At the moment of checking and recording true
, a competing process may intervene and record true
, thus two processes will be executed, although the second should have been rejected.
To avoid this, a lock is set when requesting the value, which is removed after the specified time expires, or when the variable is recorded or its value is requested with the block: false
parameter.
The read lock works only for requests that set or remove the lock through the block
parameter. When obtaining the variable @$name_glob_var, its value will be returned immediately.
Recording outside the transactional model can lead to the variable sticking in cases where the process started and the variable was set, but then the process was interrupted.
It is recommended to use together with tryCatch β in this case, the catch
records the variable reset or sets it to the initial value, which will occur if the transaction is canceled.
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: procVar(name: ""; value: ; default: )
Saves and returns the value of a variable in the php process. Short reference $@name_proc_var
Required parameters
Optional parameters
value β the value assigned to the variable and returned by the function.
default β works only in the absence of the value
parameter, assigns a value to the variable if it is not defined when accessed. Calculated at the start of the function in any case.
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: exec(code: ; var: "" = ; var: "" = ; ssh: )
Executes the code passed in the code
parameter. The invoked code will be executed according to the rules of the section from which it was called.
Required Parameters
code β code to be executed in Totum syntax.
It can be passed in the following syntax:
=: exec(code: $code)
```code:totum
=: set(table: 'table'; field: 'field' = $value)
value: "some_value"
```
In this case, the code inside the code
block is processed as text, and its $
and $#
do not intersect with the code of the current field. :totum
means to highlight as Totum code.
In code
, it is possible to pass the name
of another field in the current table, then the code will be taken from it from the corresponding type of code. When called from code β code, when called from action code β action code, etc. In this case, if you click on "name"
, a button will be shown that opens the target code for editing in a pop-up window.
Also, in code
, you can use the reference @table.field
or @table.field.key_field[key]
. In this case, if you click on @...
, a button will be shown that opens the target code for editing in a pop-up window.
Optional Parameters
var β definition of a variable and its value to be passed to the code defined in code:
.
var
does not repeat and does not intersect with the values of other variables inside the code.code
is done through access to variables inside the code.ssh β true
if the action needs to be separated into a separate process and removed from the current chain. Usage must be allowed in Conf.php.
example: exec(code: @table.h_code_text.name[some_code]; var: "varname" = 10)
// h_code_text
// "=: 10 + $#varname"
// Result: 20
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: errorException(text: )
Interrupts the execution of the entire chain of codes and actions, canceling all changes made.
If the chain catches exceptions through the tryCatch function, execution will continue from the catch
block of that function.
The message specified in text
will be placed in a variable named by the error
parameter of the tryCatch function call.
Required parameters
example: if(condition: $#nfv = "Invalid value"; then: $error)
error: errorException(text: "You entered an invalid value. Nothing was saved.")
// Result: If the code was executed within a web session, the user will see an error message with the text: "You entered an invalid value. Nothing was saved." and the name of the table where the code was placed.
// If the code was executed by an api-script, it will return an error message in the format of that api.
// Cron will receive an exception and may send an error email to the administrator.
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: tryCatch(try: ; catch: ; error: "exception")
Executes try
. If an error occurs during the execution of try
that rolls back the transaction, it executes catch
and passes the error text to the error
variable.
Required parameters
try β code string value, the main code.
catch β code string value, which is executed in case of any error in try
.
Optional parameters
example1: tryCatch(try: $test1; catch: 2; error: "exception")
test1: 1
// Result: 1
example: tryCatch(try: $test2; catch: $#exception; error: "exception")
test2: errorExeption(text: "test")
// Result: test
Has a sugar form:
=name_row_for_catch:
name_row_for_catch:
This form means that it is a tryCatch
where the catch
specifies the code string name_row_for_catch
and error: "exception"
.
It is recommended to use it together with global variables, writing in catch
a rollback to the original values in case of an error in try
.
=catch: 1
catch: 2
// Result: 1
=catch: errorExeption(text: "test")
catch: $#exception
// Result: test
Throwing into
catch
in case of simultaneous access error guarantees stopping the automatic action restart!
Available in sections: Code; Action Code
=: reCalculate(table: ''; cycle: ; hash: ; where: '' = ; field: '')
Recalculates the specified table defined in table
according to its recalculation unit.
This function can be called from any code section to recalculate the table from which data is taken before taking the data! This capability can lead any table into an infinite loop! See the recovery instructions here.
Required parameters
Optional parameters
cycle β defines the cycle if the table
is a calculated in cycle table.
table
is in a tree.hash β string, hash of the table to recalculate temporary tables.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.where
, various comparison combinations can be obtained: one to one, one to many, many to many.table
, the entire table will be recalculated regardless of the presence/absence of the parameter and the results of its operation.If
*ALL*
is passed inwhere:
, thiswhere
will be disabled! This can be done through a separate line, for example:
=: reCalculate(table: 'table_name'; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list of one value ["*ALL*"]
will be processed the same as "*ALL*"
.
field β name-parameter, the name of the field to execute the Code on Add. Allows re-execution of the Code of the field with the Only on Add parameter set.
field
parameters are specified, the codes will be executed for several fields.Example 1:
tablename β table with row recalculation unit.
id | fieldname |
---|---|
1 | test1 |
2 | test2 |
3 | test3 |
example1: recalculate(table: 'tablename'; where: 'fieldname' = "test3")
// Result: recalculation of row id = 3
Example 2:
tablename β calculated table being a recalculation unit.
id | fieldname |
---|---|
1 | test1 |
2 | test2 |
3 | test3 |
example2: recalculate(table: 'tablename')
// Result: recalculation of all fields
Example 3:
tablename β table with row recalculation unit and fields in the header.
h_fieldname
id | fieldname |
---|---|
1 | test1 |
2 | test2 |
3 | test3 |
example3: recalculate(table: 'tablename'; where: 'id' = 0)
// Result: recalculation of only h_fieldname
Available in sections: Code; Action Code.
=: reCalculateCycle(table: ''; cycle: )
Sequentially recalculates tables in cycles. If a table was updated as a result of recalculating a cycle, it is not recalculated again. Works in codes similarly to recalculate.
Mandatory parameters
table β name-parameter name of the cycle table in which the cycles will be recalculated.
cycle β defines the cycle or list of cycles to be recalculated.
Example:
cycles_table calcs_table_1 (triggers recalculation of calcs_table_3) calcs_table_2 calcs_table_3
example: reCalculateCycle(table: 'cycles_table'; cycle: 3)
// Result: *calcs_table_1* will be recalculated, which will trigger the recalculation of *calcs_table_3*, then *calcs_table_2* will be recalculated
Available in sections: Action Code.
=: set(table: ''; cycle: ; hash: ; field: '' = ; where: '' = ; log: true)
Changes values in the field
columns in the table
outside the row part.
Changes values in one row in the field
columns in the table
.
Required parameters
table β name-parameter name of the table where the data is changed.
field β name-parameter column in the table
where the data and value are changed.
field
in the table
.field: 'fieldname' + NUM
(add) or field: 'fieldname' - NUM
(subtract), field: 'fieldname' * NUM
(multiply) and field: 'fieldname' / NUM
(divide), as well as similar actions with percentages field: 'fieldname' + 2%
.+
or -
instead of =
.If a string value *NONE*
is passed, the parameter will be disabled: field: 'field_name' = "*NONE*"
.
Optional parameters
cycle β number, single or list, determines the cycle if the table:
is calculated in a cycle.
hash β string
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part β the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.If
*ALL*
is passed towhere:
, thiswhere:
will be disabled! This can be done through a separate line, for example:
=: set(table: 'table_name'; field: 'field_name' = "new_value"; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list of one value ["*ALL*"]
will be processed the same way as "*ALL*"
.
true
to add the operation to the internal logging table.If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
Example 1:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
example1: set(table: 'tablename'; field: 'fieldname1' = "ZZZ"; where: 'fieldname2' = "test22")
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | ZZZ | test22 |
3 | test31 | test23 |
Example 2:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | 10 |
2 | test21 | 20 |
3 | test31 | 30 |
example2: set(table: 'tablename'; field: 'fieldname2' + 100; where: 'fieldname1' = "test21")
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | 10 |
2 | test21 | 120 |
3 | test31 | 30 |
Available in sections: Action Code.
=: setList(table: ''; cycle: ; hash: ; field: '' = ; where: '' = ; log: )
Changes the value in multiple rows in the field
columns of the table
. The same change is applied to all fields within the range. Applicable only for changing fields located in the row part.
Required Parameters
table β name-parameter name of the table in which the data is changed.
field β name-parameter field in the table
where the data is changed, as well as its value.
field
in the table
.field: 'fieldname' + NUM
(add) or field: 'fieldname' - NUM
(subtract), field: 'fieldname' * NUM
(multiply) and field: 'fieldname' / NUM
(divide), as well as similar actions with percentages field: 'fieldname' + 2%
.+
or -
instead of =
.If a string value *NONE*
is passed, the parameter will be disabled: field: 'field_name' = "*NONE*"
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table:
is calculated in a cycle.
hash β string, hash of the table to perform the action in a temporary table.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part β the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.If
*ALL*
is passed inwhere
, thiswhere
will be disabled! This can be done through a separate line, for example:
=: setList(table: 'table_name'; field: 'field_name' = "new_value"; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list of one value ["*ALL*"]
will be processed the same as "*ALL*"
.
true
to add the operation to the internal logging table.If a
"string"
is passed inlog
instead oftrue
, the log will record the passed string instead ofScript
.
Example 1:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
example1: setlist(table: 'tablename'; field: 'fieldname1' = "ZZZ"; where: 'id' >= 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | ZZZ | test22 |
3 | ZZZ | test23 |
Example 2:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | 10 |
2 | test21 | 20 |
3 | test31 | 30 |
example2: set(table: 'tablename'; field: 'fieldname2' - 10%; where: 'id' < 3)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | 9 |
2 | test21 | 18 |
3 | test31 | 30 |
Available in sections: Action Code.
=: setListExtended(table: ''; cycle: ; hash: ; field: '' = ; where: '' = ; log: true)
Changes values in multiple rows and fields of a table simultaneously. Different values are applied to the rows according to the lists passed to the right part of field:
.
Required Parameters
table β name-parameter name of the table where the data is changed.
field β name-parameter field in the table
in the form field: 'field_name'
= + - * /
list or single value.
field
is presented as a list, the change will be applied row by row according to the list in where
.field
is a single value, this value will be set in each modified row.field
is shorter than another and shorter than the number of rows to be modified, null
will be set as the missing values.If you pass the string value *NONE*
, the parameter will be disabled: field: 'field_name' = "*NONE*"
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table:
is calculated in a cycle.
hash β string, for changes in temporary tables.
where β name-parameter, condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value. Multiple parameter.
field
parameters. Thus, changes are formed for multiple rows at once.If you pass the string value *ALL*
, the parameter will be disabled: where: 'field_name' = "*ALL*"
.
log β true
to add the operation to the internal logging table.
If you pass a
"string"
instead oftrue
tolog
, the log will record the passed string instead ofScript
.
Example:
test
id | a | b | c |
---|---|---|---|
1 | q | 10 | z |
2 | w | 20 | x |
3 | e | 30 | c |
4 | e | 30 | c |
5 | e | 30 | c |
example: setListExtended(table: 'test'; field: 'a' = $listA; field: 'b' + $listB; field: 'c' = "z"; where: 'id' = $listId)
listA: listCreate(item: "r"; item: "t"; item: "y")
listB: listCreate(item: 3; item: 2; item: 1)
listId: listCreate(item: 1; item: 2; item: 3)
// Result: Table changed.
test
id | a | b | c |
---|---|---|---|
1 | r | 13 | z |
2 | t | 22 | z |
3 | y | 31 | z |
4 | e | 30 | c |
5 | e | 30 | c |
Available in sections: Action Code
=: insert(table: ''; cycle: ; hash: ; field: '' = ; inserts: "inserts"; after: ; log: true)
Action function β adds one row to the target table.
Required parameters
Optional parameters
field β in the format field: 'field_name' = "value"
, fields to be filled in upon insertion.
field
will be calculated according to their code section or default values.If you pass the string value *NONE*
, the parameter will be disabled: field: 'field_name' = "*NONE*"
.
cycle β defines the cycle if the table
is calculated in a cycle.
table
is in a tree.hash β string, table hash for performing the action in temporary tables.
inserts β the name of the variable to which the list with the ids of the inserted rows will be added as a result of the operation.
after β number, for tables sorted by n
β the id of the row after which to insert the new one.
0
as the parameter, it means before all existing rows.fields β associative array, where the keys are the name
of the fields.
log β true
to add the operation to the internal logging table.
If you pass a
"string"
instead oftrue
inlog
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
example: while(action: $insert; action: $showid)
insert: insert(table: 'tablename'; field: 'fieldname1' = "test"; field: 'fieldname2' = "globcalcs"; inserts: "shownewid")
showid: $#shownewid
// Result: Row added, code returns value [4]
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
4 | xxx | yyy |
Available in sections: Action Code.
=: insertList(table: ''; cycle: ; hash: ; fields: ; field: '' = ; inserts: "inserts"; after: ; log: true)
Adds multiple rows to the table
with specified field values field
Required parameters
table β name-parameter, the name of the table to which rows are added.
field β in the format field: 'field_name' = "some_value"
. Complements and replaces if the name
specified in fields
is repeated. Multiple parameter.
If a list is passed in the value
, the number of rows added will match the number of elements in the list. Each added row will contain the value from the passed list 1 to 1.
If there are multiple field
in the call and one contains a list while another contains a single value
If a string value *NONE*
is passed, the parameter will be disabled: field: 'field_name' = "*NONE*"
.
Optional parameters
cycle β number, single or list, specifies the cycle if the table
is a calculated in cycle table.
hash β string, the hash of the table for performing the action in temporary tables.
fields β associative array, where the keys are the name
of the fields and the values are lists for row-by-row filling of the added rows.
Or list of associative arrays. Either option.
inserts β the name of the variable to which a list with the ids of the rows added as a result of the operation will be added.
after β number, for tables sorted by n
β the id of the row after which to insert new rows.
0
is passed, it means before all existing rows.log β true
to add the operation to the internal logging table.
If a
"string"
is passed inlog
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
example: while(action: $insert; action: $showid)
insert: insertList(table: 'tablename'; fields: $row1; field: 'fieldname2' = $list2; inserts: "shownewid")
row1: rowCreate(field: "fieldname1" = $list1)
list1: listCreate(item: "XX"; item: "XXX")
list2: listCreate(item: "YY"; item: "YYY")
showid: $#shownewid
// Result: Rows added, code returns value [4,5]
example2: while(action: $insert2; action: $showid2)
insert2: insertList(table: 'tablename'; fields: $selectRowList; inserts: "shownewid2")
selectRowList: selectRowList(table: 'table_xy'; field: 'xxx'; field: 'yyy')
showid2: $#shownewid2
// Result: Rows added, code returns value [4,5]
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
4 | XX | YY |
5 | XXX | YYY |
Available in sections: Action Code.
=: delete(table: ''; cycle: ; hash: ; where: '' = ; log: true)
Deletes a row in the table:
that matches the where:
conditions.
Required Parameters
table β name-parameter name of the table from which data is taken.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.If
*ALL*
is passed towhere
, thiswhere
will be disabled! This can be done through a separate line, for example:
=: delete(table: 'table_name'; where: 'search_field' = $if)
if: if(condition: #connected_field = ""; then: "*ALL*"; else: #connected_field)
A list of one value ["*ALL*"]
will be processed the same way as "*ALL*"
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table:
is calculated in a cycle.
hash β string, for performing the action in a temporary table.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
true
. Allows deleting a row even if the table has the Hide on delete parameter set.Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 | 20 |
3 | 10 | 20 |
example: delete(table: 'tablename'; where: 'id' = 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
3 | 10 | 20 |
Available in sections: Action Code.
=: deleteList(table: ''; cycle: ; hash: ; where: '' = ; log: true)
Deletes multiple rows in the table
that match the where
conditions.
Required Parameters
table β name-parameter, the name of the table from which data is taken.
where β name-parameter, condition for selecting rows in the string part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.*ALL*
is passed to where
, this where
will be disabled!If a string value *ALL*
is passed, the parameter will be disabled: where: 'field_name' = "*ALL*"
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table
is calculated in a cycle.
hash β string, for deleting rows in a temporary table.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
true
. Allows deleting a row even if the table has the Hide on delete parameter set.Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 | 20 |
3 | 10 | 20 |
example: deleteList(table: 'tablename'; where: 'id' >= 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
Available in sections: Action Code.
=: duplicate(table: ''; cycle: ; hash: ; field: '' = ; where: '' = ; after: ; log: true)
Duplicates a single row in the table
. Applicable only in the row part.
Required parameters
table β name-parameter name of the table where the duplication is performed.
field β name-parameter field in the table
where data is changed during duplication, as well as its value in the format field: 'field_name' = "value"
.
field
in the table
.Optional parameters
cycle β number, single or list, determines the cycle if the table:
is calculated in a cycle.
hash β string, hash of the table for performing the action in temporary tables.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where:
parameters are specified, the selection is made at the intersection of their conditions.order
.*ALL*
is passed to where:
, this where
will be disabled!inserts β the name of the variable to which a list with the ids of the inserted rows will be added as a result of the operation.
while
with iterators in one code section.after β number, for tables sorted by n
β id of the row after which to insert the duplicated one.
0
is passed as the parameter value, it means before all existing rows.log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
example: duplicate(table: 'tablename'; field: 'fieldname1' = "ZZZ"; where: 'id' = 3)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
4 | ZZZ | test23 |
Available in sections: Action Code.
=: duplicateList(table: ''; cycle: ; hash: ; field: '' = ; where: '' = ; after: ; log: true)
Duplicates multiple rows in the table:
. Applicable only in the row part.
Required Parameters
table β name-parameter name of the table where duplication is performed.
field β name-parameter field in the table
where data is changed during duplication, as well as its value in the format field: 'field_name' = "value"
.
field
in the table
.Optional Parameters
cycle β number, single or list, defines the cycle if the table
is calculated in a cycle.
hash β string, hash of the table to perform the action in a temporary table.
where β name-parameter condition for selecting rows in the row part. The left part defines the comparison field in the table
, and the right part β the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.order
.*ALL*
is passed to where
, this where
will be disabled!inserts β the name of the variable to which a list with the ids of the new rows will be added.
after β number, for tables sorted by n
β id of the row after which to insert the new ones.
0
is passed as the parameter value, it means before all existing rows.log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog:
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
example: duplicateList(table: 'tablename'; field: 'fieldname1' = "ZZZ"; where: 'id' >= 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | test11 | test12 |
2 | test21 | test22 |
3 | test31 | test23 |
4 | ZZZ | test22 |
5 | ZZZ | test23 |
Available in sections: Action Code.
=: pin(table: ''; cycle: ; hash: ; field: ''; where: '' = ; log: true)
Sets a value pin for a single field with an active code section.
Required Parameters
table β name-parameter name of the table where the action is performed.
field β name-parameter field in the table
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table
is calculated in a cycle.
hash β string, table hash for performing the action in temporary tables.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.were:
is passed the value *ALL*
, this where
will be disabled!If a string value *ALL*
is passed, the parameter will be disabled: where: 'field_name' = "*ALL*"
.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 | 20 |
3 | 10 | 20 |
example: pin(table: 'tablename'; field: 'fieldname1'; where: 'id' = 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 [HAND] | 20 |
3 | 10 | 20 |
Available in sections: Action Code.
=: pinList(table: ''; cycle: ; hash: ; field: ''; where: '' = ; log: true)
Sets a value pin for a field with an active code section in multiple rows. Not applicable outside the row part.
Required Parameters
table β name-parameter name of the table where the action is performed.
field β name-parameter field in the table
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table:
is a calculated in cycle table.
hash β string, table hash for performing the action in temporary tables.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.*ALL*
is passed to where
, this where
will be disabled!If a string value *ALL*
is passed, the parameter will be disabled: where: 'field_name' = "*ALL*"
.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 | 20 |
3 | 10 | 20 |
example: pinList(table: 'tablename'; field: 'fieldname1'; where: 'id' >= 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 [HAND] | 20 |
3 | 10 [HAND] | 20 |
Available in sections: Action Code.
=: clear(table: ''; cycle: ; hash: ; field: ''; where: '' = ; log: true)
Resets the fixed values for fields with an active code section to their calculated values.
Required Parameters
table β name-parameter name of the table where the action is performed.
field β name-parameter field in the table
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table
is a calculated in cycle table.
hash β string, table hash for performing the action in a temporary table.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.where
is passed the value *ALL*
, this where
will be disabled!If a string value *ALL*
is passed, the parameter will be disabled: where: 'field_name' = "*ALL*"
.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 12 [HAND] | 20 |
3 | 10 | 20 |
example: clear(table: 'tablename'; field: 'fieldname1'; where: 'id' = 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 | 20 |
3 | 10 | 20 |
Available in sections: Action Code.
=: clearList(table: ''; cycle: ; hash: ; field: ''; where: '' = ; log: true)
Resets the fixation of values for fields with an active code section to calculated values in multiple rows.
Required Parameters
table β name-parameter name of the table where the action is performed.
field β name-parameter field in the table
.
Optional Parameters
cycle β number, single or list, defines the cycle if the table
is calculated in a cycle.
hash β string, for temporary tables the table hash.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.*ALL*
is passed in where
, this where
will be disabled!If a string value *ALL*
is passed, the parameter will be disabled: where: 'field_name' = "*ALL*"
.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed inlog
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 12 [HAND] | 20 |
3 | 12 [HAND] | 20 |
example: clearList(table: 'tablename'; field: 'fieldname1'; where: 'id' >= 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 | 20 |
3 | 10 | 20 |
Available in sections: Action Code.
=: restore(table: ''; cycle: ; hash: ; where: '' = ; log: true)
Restores a row in the table:
that matches the where:
conditions by searching among the hidden.
Required parameters
table β name-parameter name of the table from which the data is taken.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.*ALL*
is passed to where
, this where:
will be disabled!Optional parameters
cycle β number, single or list, defines the cycle if the table:
is calculated in a cycle.
hash β string, to perform the action in a temporary table.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
Available in sections: Action Code.
=: restoreList(table: ''; cycle: ; hash: ; where: '' = ; log: true)
Restores multiple rows in the table
that match the where
conditions among the hidden rows.
Required Parameters
table β name-parameter, the name of the table from which the data is taken.
where β name-parameter, the condition for selecting rows in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.*ALL*
is passed to where
, this where
will be disabled!Optional Parameters
cycle β number, single or list, defines the cycle if the table
is a calculated in cycle table.
hash β string, for performing row restoration in a temporary table.
log β true
to add the operation to the internal logging table.
If a
"string"
is passed tolog
instead oftrue
, the log will record the passed string instead ofScript
.
Example:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
example: restoreList(table: 'tablename'; where: 'id' >= 2)
Result:
tablename
id | fieldname1 | fieldname2 |
---|---|---|
1 | 10 | 20 |
2 | 10 | 20 |
3 | 10 | 20 |
Available in sections: Action Code.
=: execButton(table: ''; cycle: ; hash: ; field: ''; where: '' = ; order: '' asc)
Executes the action code of a single button. The code is executed from the environment of the button that contains it.
Required parameters
field β name-parameter field in the table
.
table β name-parameter name of the table from which the data is taken.
Optional parameters
cycle β number, single or list, defines the cycle if the table
is calculated in a cycle.
hash β string, for executing the action in a temporary table.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part defines the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.order
.*ALL*
is passed to where
, this where
will be disabled!order β name-parameter field in the table
by which sorting will be performed.
order
parameters are specified, sorting will be performed sequentially.var β var: "var_name" = "value"
creates a variable when calling the button code. Multiply parametr.
Available in sections: Action Code.
=: execButtonList(table: ''; cycle: ; hash: ; field: ''; where: '' = ; order: '' asc; limit: )
Sequentially calls the execution of button codes that match the conditions. Codes are executed from the button environment.
Required parameters
table β name-parameter name of the table from which the data is taken.
field β name-parameter field with buttons in the table
.
Optional parameters
cycle β number, single or list, determines the cycle if the table:
is calculated in a cycle.
hash β string, for executing the action in temporary tables.
where β name-parameter condition for selecting a row in the row part. The left part defines the comparison field in the table
, and the right part is the comparison value.
where
parameters are specified, the selection is made at the intersection of their conditions.order
.*ALL*
is passed in where
, this where
will be disabled!order β name-parameter field in the table
by which sorting will be performed.
order
parameters are specified, sorting will be performed sequentially.limit β number, sets the selection limit.
0
or ""
, it will be disabled!var β var: "var_name" = "value"
creates a variable when calling the button code. Multiply parametr.
Available in sections: Action Code.
=: reorder(table: ; ids: ; after: )
Changes the order for n-sortable tables.
Required parameters
table β name-parameter name of the table in which the order is being changed.
ids β list of the ids of the rows being moved in the order they should be placed.
Optional parameters
after β number, for tables sorted by n
β id of the row after which to insert the changed ids.
0
is passed as the parameter, it means before all existing rows.Available in sections: Action Code.
=: linkToTable(table: ''; cycle: ; hash: ; title: ; filter: '' = ; field: '' = ; target: "iframe|blank|self|parent"; width: 800; refresh: false; header: true; footer: true)
Opens the specified table in the manner defined by target
.
Required Parameters
Optional Parameters
title β string, the title displayed in the opened window for iframe
.
filter β name-parameter value of the pre-filter field. The left part defines the field, and the right part its value.
field β name-parameter value of the row part field. The left part defines the field, and the right part its value. If at least one parameter is present, an addition row will be opened with the entered values of the passed fields.
pointing β name-parameter the field in which the pointer will be placed when the table is opened.
refresh β determines whether the parent table will be refreshed when the window is closed for the iframe
option of the target
parameter.
true
if data needs to be refreshed."recalculate"
β allows recalculating the source table even if there were no changes in it."reload"
β when returning, the source table will be reloaded as if the user pressed refresh in the browser."close"
β when the called child window is closed, the parent window will be closed if the call is from an iframe.false
.cycle β single number, defines the cycle if the table
is calculated in a cycle.
hash β string, to open a previously created temporary table.
target β how the table will be opened.
iframe
β in an iframe above other windows.blank
β in a new window (for correct operation, you need to allow pop-ups in the browser)parent
β in the base bottom window, all open nested windows will be closed.self
β in the current window.self
.width β determines the width of the window in pixels for the iframe
option of the target
parameter.
header β determines whether the header will be shown in the opened window when displayed in iframe
.
false
if it needs to be hidden.true
.footer β determines whether the footer will be shown in the opened window when displayed in iframe
.
false
if it needs to be hidden.true
.topbuttons β false
, when opening a window in an iframe: the print button, field visibility management, and csv will be hidden.
bottombuttons β false
, when opening a window in an iframe: the control buttons at the bottom of the window will be hidden.
hidedots β false
, if you need to cancel hiding the button with dots in the lower right corner. It is considered equal to true
by default when opening a table in an iframe.
example: linkToTable(table: 'tablename'; title: "Opened Table"; filter: 'fl_id' = 10; field: 'fieldname' = "Data passed to the field"; target: "iframe"; width: "80vw"; refresh: true)
Available in sections: Action Code.
=: linkToScript(uri: "http://"; post: "" = ; title: ; target: "iframe|blank|self|parent"; width: 800; refresh: false)
Opens a window and calls an external script, passing values to it via POST
DO NOT USE IN CRON!
Required parameters
Optional parameters
post β string, parameters passed to the script in POST format. Multiple parameter.
title β string, the title displayed in the opened window for iframe
.
target β how the table will be opened.
iframe
β in an iframe above other windows.blank
β in a new window (for correct operation, you need to allow pop-ups in the browser)parent
β in the base bottom window, all open nested windows will be closed.self
β in the current window.close
β when the called child window is closed, the parent window will be closed if the call is from an iframe.self
width β defines the width of the window in pixels for the iframe
option of the target
parameter.
refresh β determines whether the parent table will be refreshed when the window is closed for the iframe
option of the target
parameter.
true
if data needs to be refreshed."recalculate"
β allows recalculating the source table even if there were no changes in it."reload"
β upon return, the source table will be reloaded as if the user pressed refresh in the browser.false
.example: linkToScript(uri: "https://host.com"; title: "host.com"; target: "iframe"; width: 800; refresh: false)
Available in sections: Action code.
=: linkToDataTable(table: ''; title: ; width: 800; height: "80vh"; data: $rowList; params: $row; refresh: false; header: true; footer: true; hide: false)
Calls a window with a temporary table in the user's web interface and, if necessary, passes prepared data to it.
The function can be called from code with the parameter hide: true
for calculation through a temporary table.
Required parameters
Optional parameters
title β string, window title.
width β defines the width of the window in pixels.
data β list of associated arrays to fill the row part of the table. The keys should be the name
of the row part fields.
params β associated array to fill the non-row parts of the opened table. The keys should be the name
of the non-row part fields.
pointing β name-parameter field in which the pointer will be placed when the table is opened.
height β defines the height of the window in pixels for the iframe
option of the target
parameter.
refresh β determines whether the parent table will be refreshed when the window is closed for the iframe
option of the target
parameter.
true
if data needs to be refreshed."recalculate"
β allows recalculating the source table even if there were no changes in it."reload"
β when returning, the source table will be reloaded as if the user pressed refresh in the browser."close"
β when the called child window is closed, the parent window will be closed if the call is from an iframe.false
.header β determines whether the header will be shown in the opened window when displayed in iframe
.
false
if it needs to be hidden.true
.footer β determines whether the footer will be shown in the opened window when displayed in iframe
.
false
if it needs to be hidden.true
.target β how the table will be opened.
iframe
β in an iframe above other windows.blank
β in a new window (for correct operation, pop-up windows must be allowed in the browser)parent
β in the base bottom window, all open nested windows will be closed.self
β in the current window.iframe
topbuttons β false
, when opening a window in an iframe: the print button, field visibility management, and csv will be hidden.
bottombuttons β false
, when opening a window in an iframe: the control buttons at the bottom of the window will be hidden.
hide β true
hides the display of the temporary table for the user. Used for calculation through a temporary table.
hide: true; generates a load on the database, as temporary tables are recorded in the DB after calculation and deleted after an hour.
false
, if it is necessary to cancel the hiding of the button with dots in the lower right corner. It is considered equal to false
by default when opening a table in an iframe.example: linkToDataTable(table: 'tmp_test'; title: "Temporary Calculation Window"; width: 800; height: "80vh"; data: $rowList; params: $row; refresh: false; header: true; footer: true)
rowList: jsonExtract(text: '[{"field1":1, "field2":2},{"field1":3, "field2":4}]')
row: jsonExtract(text: '{"f_summ_1":4, "f_summ_2":6}')
// Result:
Temporary Calculation Window
id | field1 | field2 |
---|---|---|
1 | 1 | 2 |
2 | 3 | 4 |
f | 4 | 6 |
sel: selectRowList(table: 'tmp_table'; hash: $hash; field: 'data'; field: 'summ'; order: 'id' asc)
~hash: linkToDataTable(table: 'tmp_table'; params: $row_hide; hide: true)
row_hide: "here are the parameters passed to tmp_table"
Available in sections: Action Code.
=: linkToDataText(title: ; text: )
Calls a message window with text content in the web interface.
Required parameters
Optional parameters
close β true
closes the parent window after the popup window is closed.
width β the width of the popup window in pixels or relative.
height β the height of the popup window in pixels or relative.
example: linkToDataText(title: "Attention"; text: "Your change has been accepted")
Available in sections: Action Code.
=: linkToDataHtml(title: ; html: )
Calls a window with html content in the web interface.
Mandatory parameters
Optional parameters
close β true
closes the parent window after the popup window is closed.
width β the width of the window in pixels.
height β the height of the popup window in pixels or relative.
scripts β (PRO only!) list
of js-script URLs, connected with automatic verification before loading the specified html
onto the page.
Available in sections: Action Code.
=: linkToPanel(table: ''; id: ; field: '' = ; refresh: false)
Opens a table row as a panel.
Required parameters
Optional parameters
id β number, id of the row to be opened.
field β name-parameter field in the table
. When a value is passed to the right side of the expression, it substitutes this value into the field when opening the panel. Multiple parameter.
refresh β determines whether the parent table will be refreshed when the window is closed.
true
if data needs to be refreshed."recalculate"
β allows recalculating the source table even if there were no changes in it."reload"
β upon return, the source table will be reloaded as if the user pressed refresh in the browser."close"
β at the moment of closing the called panel window, the parent window will be closed if the call is from an iframe.false
.bfield β used instead of id
in the syntax bfield: 'field_name' = "value"
.
cycle β single number, determines the cycle if the table
is calculated in a cycle.
hash β hash, if a row is opened from a temporary table.
fields β list of name
fields to limit the loading of fields into the panel when it is opened.
titles β allows setting custom field titles when opening the panel:
row
:{
"name_field_1": "Custom name for field 1",
"name_field_2": "Custom name for field 2",
"name_field_3": "Custom name for field 3"
}
rowlist
:= : linkToPanel(table: 'simple'; titles: $rowList; id: #id; refresh: false; columns: 1)
rowList: rowListCreate(field: "name" = $listOfNames; field: "title" = $listOfTitles)
listOfNames: listCreate(item: "select_1"; item: "select_2")
listOfTitles: listCreate(item: "Name 1"; item: "Name 2")
columns β 1
or 2
(default). Changes the display of the number of columns when opening the panel.
example: linkToPanel(table: 'tablename'; id: $num; refresh: true)
num: 10
// Result: opens the row with id=10 of the table tablename in the panel.
Available in sections: Action Code.
=: linkToEdit(title: ""; table: ''; cycle: ; field: ''; id: ; refresh: false)
Opens a pop-up window for editing the content of a field.
Required parameters
table β name-parameter name of the table from which the data is taken.
field β name-parameter field in the table
.
title β title of the window.
Optional parameters
id β id of the row if the field being opened is in the row part of the table.
cycle β number, determines the cycle if the table
is calculated in a cycle.
hash β string, for temporary tables hash of the table.
refresh β determines whether the parent table will be refreshed when the window is closed.
true
if data needs to be refreshed.false
."reload"
β upon return, the source table will be reloaded as if the user pressed refresh in the browser."recalculate"
β recalculate the source table even if there were no changes in it."close"
β at the moment of closing the called field window, the parent window will be closed if the call is from an iframe.Available in sections: Action Code.
=: linkToPrint(template: ; data: $data; text: )
Calls printing by template. The full mechanism of action is described in the section Printing.
Instead of template
, you can pass text
, then replacements will be made in it. This way, you can form a print template with code.
Available in sections: Action code.
=: linkToButtons(title: ; html: ; buttons: ; refresh: false; close: false)
Calls a panel with buttons. When a button is pressed, the corresponding action code is executed.
Required parameters
title β window title.
buttons β list of associative arrays, each row of which is a button.
Structure of row
:
text
β string label on the button. Required parameter.
code
β string code that will be executed when the button is pressed. It can be the name
of a field in the current table from which the action code will be taken for execution. Required parameter.
code must be passed as a string
code: "....."
, referencing subsequent code does not work.
icon
β string name of the fontawersome 4
icon without fa-
background
β string name of the web_color
or HEX #ddd
.
vars
β associative array with keys and values of variables that will be passed to the executed code.
refresh
β allows specifying refresh for a specific button in the stack.
Optional parameters
html β html that will be displayed in the button panel.
refresh β true
allows updating the table after the button is executed. "recalculate"
β allows recalculating the source table even if there were no changes in it. "reload"
β upon return, the source table will be reloaded as if the user pressed refresh in the browser.
close β true
allows closing the source table if it is open in an iframe after the button is executed. Necessary because closing the window after execution in the button settings calling linkToButtons
or linkToInput leads to their inoperability!
=: linkToButtons(title: "Red or Blue"; buttons: $buttons; width: 400; html: "YOU ARE NEO")
buttons: listCreate(item: $btn1; item: $btn2)
btn1: rowCreate(field: "text" = "Red"; field: "code" = $code1; field: "icon" = "link"; field: "background" = "seashell"; field: "color"="red"; field: "vars" = $vars1; field: "refresh" = false)
vars1: rowCreate(field: "var1" = "You chose the red pill")
code1: strAdd(str: '=: linkToDataText(title: "III"; text: $#var1)')
btn2: rowCreate(field: "text" = "Blue"; field: "code" = "name_field_in_table"; field: "icon" = "link"; field: "background" = "eliceblue"; field: "vars" = $vars2; field: "refresh" = true)
vars2: rowCreate(field: "var1" = "You chose the blue pill")
// text and code are required parameters in row, the rest are not.
// Result: An active panel with two buttons, pressing each of which opens a panel with text.
Available in sections: Action code.
=: linkToInput(title: ; html: ; code: ; type: ; var: ; value: ; refresh: true; button: "Save"; close: false)
Calls a panel with an input field. When the confirmation button is pressed, the code passed in code is executed as action code.
The value entered in the input field will be passed to the input
variable.
Required parameters
title β string, the title of the window.
code β string, the code that will be executed after data entry.
Or string β the name
of the field in the same table from which the action code will be taken.
code must be passed as a string
code: "....."
, referencing subsequent code does not work.
It can be passed in the following syntax:
=: linkToInput(title: "Title"; code: $code)
```code:totum
=: set(table: 'table'; field: 'field' = $#input)
```
In this case, the code inside the code
block is processed as text, and its $
and $#
do not intersect with the code of the current field. :totum
means to highlight as totum code.
In code:
, you can pass the name
of another field in the current table.
You can also use the @table.field
or @table.field.key_field[key]
reference in code
. In this case, if you click on @...
, a button will be shown that opens the target code for editing in a pop-up window.
Optional parameters
type β string, the type of html input
processed by the browser:
tel
β phone number (on mobile devices, the numeric keyboard is activated).password
β password (hides the entered characters under an asterisk - '*').number
β number (adds control elements - arrows).datetime-local
β local date and time (adds control elements: calendar and clock).month
β month and year (adds control elements and calendar).week
β week number (adds control elements and calendar).time
β time, hours and minutes (adds control elements).button β string, the label on the confirmation button.
var β multiple parameter, passed as var: "var_name" = "var_value"
. Parameters that can be used in code.
value β string, the default value that will be passed to the opened input.
refresh β true
allows the table to be refreshed after the button is executed. "recalculate"
β allows the source table to be recalculated even if there were no changes in it. "reload"
β when returning, the source table will be reloaded as if the user pressed refresh in the browser.
close β true
allows the source table to be closed if it is open in an iframe after the button is executed. Necessary because closing the window after execution in the button settings that call linkToButtons or linkToInput
makes them non-functional!
html β html that will be shown in the panel with the input field. If the html has a textarea
(can be hidden) with id="ttmInput"
, the standard input field will be disabled, and the value from the textarea
will be passed to the $#input
variable. This way, you can use your own js-form.
<textarea id="ttmInput">{"name":111, "name2":2223}</textarea>
example: linkToInput(html: "Enter order number"; title: "Open order by number"; code: $stradd; refresh: false; button: "Open")
stradd: strAdd(str: '=: linkToTable(table: "sostav_zakaza"; cycle: $number; target: "top")'; str: $#nl; str: 'number: select(table: "novye_zakazy"; field: "id"; where: "nomer" = $#input)')
// Result: A window with an empty input field, the label Enter order number, and the buttons "Cancel" and "Open".
Available in sections: Action Code.
=: linkToInputSelect(title: ; code: ; codeselect: ; var: ; width: ; value: ; refresh: ; button: ; close: ; multiple: )
Calls a panel with an input field in the form of a dropdown list. When the confirmation button is pressed, the code passed in code is executed as action code.
The value entered in the input field will be passed to the input
variable.
Required parameters
title β string, the title of the window.
code β string, the code that will be executed after data entry.
Or string β name
of the field in the same table from which the action code will be taken.
code must be passed exactly as a string
code: "....."
, the option where you refer to subsequent code does not work.
It can be passed in the following syntax:
=: linkToInputSelect(title: "Title"; code: $code; codeselect: $codeselect)
```code:totum
=: set(table: 'table'; field: 'field' = $#input)
```
```codeselect:totum
=: selectRowListForSelect(table: 'table_name'; field: 'field_name')
```
In this case, the code inside the code
block is processed as text, and its $
and $#
do not intersect with the code of the current field. :totum
means to highlight as totum code.
In code:
it is possible to pass the name
of another field in the current table.
Also in code
, you can use the reference @table.field
or @table.field.key_field[key]
. In this case, if you click on @...
, a button will be shown that opens the target code for editing in a popup window.
codeselect β string, select code. Requirements are similar to code.
Optional parameters
button β string, the label on the confirmation button.
var β multiple parameter, passed as var: "var_name" = "var_value"
. Parameters that can be used in code.
value β string, the default value that will be passed to the open input.
refresh β true
allows you to refresh the table after the button is executed. "recalculate"
allows you to recalculate the source table even if there were no changes in it. "reload"
β when returning, the source table will be reloaded as if the user pressed refresh in the browser.
close β true
allows you to close the source table if it is open in an iframe after the button is executed. Necessary because closing the window after execution in the button settings that call linkToButtons or linkToInput
leads to their inoperability!
multiple β true
if the select is multiple.
"force"
β in this case, for a single select, the code
will be executed immediately upon selecting a value.Available in sections: Action Code.
=: linkToDataJson(title: ; data: )
Opens a json-editor
window with the content from data
.
Required parameters
data β data to be opened in the json-editor
.
title β title of the window.
Optional parameters
width β defines the width of the window in pixels.
code β code executed when the button is pressed; the json value is passed to the code in the $#value
variable.
It can be passed in the following syntax:
=: linkToDataJson(title: "Title"; data: "some_data"; code: $code)
```code:totum
=: set(table: 'table'; field: 'field' = $#value)
```
In this case, the code inside the code
block is processed as text, and its $
and $#
do not intersect with the code of the current field. :totum
means to highlight as totum code.
In code
, it is possible to pass the name
of another field in the current table.
Also, in code
, you can use the reference @table.field
or @table.field.key_field[key]
. In this case, if you click on @...
, a button will be shown that opens the target code for editing in a pop-up window.
buttontext β text on the button.
var β multiple parameter, var: "var_name" = "value"
; parameters to be passed to the code. Can be accessed via $#name
.
refresh β true
to refresh the table upon closing the window. It is also possible to use "recalculate"
and "reload".
Available in sections: Action Code.
=: linkToFileUpload(title: ; code: ; limit: ; type: "*"; var: ; refresh: false)
Opens a system file selection window.
Required parameters
code β string code that will be executed upon upload.
The variable $#input
is passed a structure similar to the File field type.
The name
of a field in the current table can be passed, from which the action code will be taken for execution. Required parameter.
Must be passed as a string code: "....."
, referencing subsequent code does not work.
It can be passed in the following syntax:
=: linkToFileUpload(code: $code)
```code:totum
=: set(table: 'table'; field: 'file_field' = $input)
```
In this case, the code inside the code
block is processed as text, and its $
and $#
do not intersect with the current field's code. :totum
means to highlight as totum code.
In code:
it is possible to pass the name
of another field in the current table, then the code will be taken from it from the corresponding type of code. When called from code β code, when called from action code β action code, etc... In this case, if you click on "name"
, a button will be shown that opens the target code for editing in a pop-up window.
Also in code
you can use the reference @table.field
or @table.field.key_field[key]
. In this case, if you click on @...
, a button will be shown that opens the target code for editing in a pop-up window.
Optional parameters
title β window title.
limit β maximum number of files. If more are selected, an error message will be displayed instead of code
.
type β mime-type if required.
var β of the form var: "var_name" = VAR_VALUE
. Multiple parameter β one or more variables to pass to code
.
refresh β determines whether the parent table will be refreshed upon closing the window.
true
if data needs to be refreshed.false
."reload"
β upon return, the source table will be reloaded as if the user pressed refresh in the browser."recalculate"
β the source table will be recalculated even if there were no changes in it.Example:
= : linkToFileUpload(title: "File Upload"; code: "=: set(table: $#ntn; field: 'h_files' = $#input)"; limit: 2; type: "image/*"; refresh: true)
//Result: 2 selected files will be added to the h_files field, the table will be refreshed.
Available in sections: Action Code.
=: linkToFileDownload(file: ; files: )
Downloads files to the client's computer through the web interface.
Optional parameters
file β Multiple parameter, associative array in the format {"name":"File name to save on the client's computer", "type":"mime-type of the file", "filestring": "String content of the file"}
files β list of associative arrays similar to the file
format.
zip β zip: "name_of_file"
, will pack the provided files into a single zip archive.
EXAMPLES
example: linkToFileDownload(file: $file)
file: rowCreate(field: "name" = "file.jpg"; field: "type" = "image/jpeg"; field: "filestring" = $img)
img: fileGetContent(file: #h_files[0]["file"])
//Result: Initiates the download of a jpeg image to the client's computer and saves it with the name "file.jpg"
example2: linkToFileDownload(file: $file1; file: $file2)
file1: rowCreate(field: "name" = "file.txt"; field: "type" = "text/plain"; field: "filestring" = "File content")
file2: rowCreate(field: "name" = "file2.txt"; field: "type" = "text/plain"; field: "filestring" = "File content2")
//Result: Initiates the download of two text files to the client's computer and saves them with the specified names
Available in sections: Code; Action Code.
=: getFromScript(uri: "http://"; post: "" = ; posts: ; gets: ; bfl: ; timeout: ; header: ; headers: ; ssh: ; method: )
Calls a script at the specified path and sends a POST or GET request to it.
If headers are not specified in the headers
parameter, POST is executed as application/x-www-form-urlencoded
.
Required parameters
Optional parameters
post β multiple parameter, POST parameter in the format post: "param_name" = "value"
.
posts β associative array, list of POST parameters or string of the POST request body.
gets β associative array, list of GET parameters.
bfl β true|false
determines whether to write data to the bfl log. If absent, it takes the setting from Settings and cron.
timeout β request time limit in seconds.
header β true | false
determines whether to return header+body
or only the body
of the response.
If true
and you need to make it more readable, you can use strSplit:
= : linkToDataHtml(title: "test"; html: $join)
join: listJoin(list: $split; str: "<br>")
split: strSplit(str: $get; separator: str`$#nl`)
get: getFromScript(uri: "..."; header: true)
headers β list of headers to be sent.
ssh β if true
is passed, the call will be separated into a separate process and will be executed in parallel with the subsequent code. Used to call external services whose response is not important for the subsequent code. For example, calling an SMS sending server when the order status changes. This way, the external server will not stop processing inside totum in case of its unavailability or long response time.
method β "POST | GET | PUT | DELETE | ..."
is used to explicitly set the HTTP method. Automatically, if POST
is empty, GET
is sent β this parameter allows overriding this behavior.
example: getFromScript(uri: "https://host.com/"; post: "method" = "setBids"; post: "bids" = $bids; post: "token" = @some_table.token["access_token"]; post: "feed_id" = @some_table.feed_id; post: "shop_id" = @some_table.store_number)
bids: jsonCreate(data: $bidsGet)
bidsGet: selectRowList(table: 'some_table_with_data'; field: 'price'; field: 'item_name'; where: 'add_to_feed' = true)
//Incoming variables: $#x_request_id, $#data_for_send
example2: getFromScript(uri: @some_table.url; posts: $json; headers: $headers)
headers: listCreate(item: $auth; item: "Content-type: application/json"; item: $xxx)
xxx: strAdd(str: "X-Request-ID: "; str: $#x_request_id)
auth: strAdd(str: "Authorization: Basic "; str: @some_table.autorisation)
json: jsonCreate(data: $#data_for_send)
If you pass
true
orfalse
to thepost
orgets
parameter of the function, they must be passed as a string β"true"
or"false"
. Otherwise, they will be converted to1
and""
when passed.
Available in sections: Action Code.
=: emailSend(to: ; title: ; body: ; from: ; files: ; bfl: )
Sends an email. By default, through the server's emailsend
.
The email can also be sent using the notificationSend function.
Required parameters
title β string, the email subject.
to β string, recipient's email. Or a list of strings with recipients' email
. In this case, the email will be sent to multiple recipients as an open copy.
body β string, the email body. Processed as html
.
Optional parameters
from β string, sender's email. If not specified, the system email like noreply@HOST
is used. The formation of the technical email can be overridden in Conf.php
in the root folder of Totum or in the Settings table. Conf.php
has priority.
files β list or associative array to include attached files in the email.
rowList
with keys similar to the file field β name
and file
associative array of the form display name in email: technical name on the server
.
file
key.If the email body in body
contains images with src = "path to file in the current totum schema"
β these files will be automatically attached to the email.
replyto β string with the address to which the reply will be sent when the recipient clicks the reply button in the email client.
hiddencopy β string or list with the address/addresses to which a blind copy will be sent.
bfl β if true
, the email sending data is stored in the _bfl
database table even if the transaction was rolled back.
example: emailSend(to: "test@example.ru"; title: "Sending an email"; body: "Test email"; files: $files)
files: rowCreate(field: "Attached image.png" = "444_h_pole_heder_1_1.png")
// To get the file name from the file field #file_field[0][file]
// The extension must be specified in the name of the sent file
// for example, sending two files located in the file_field:
example2: emailSend(to: "test@example.ru"; title: "Sending an email"; body: "Test email"; files: $files2)
files2: rowCreate(field: "Attached image.png" = #file_field[0][file]; field: "Attached image 2.png" = #file_field[1][file])
// or using the full data of the file field:
example3: emailSend(to: "test@example.ru"; title: "Sending an email"; body: "Test email"; files: #file_field)
// using filestring
example4: emailSend(to: "test@example.ru"; title: "Sending an email"; body: "Test email"; files: json`[$filerow]`)
fileRow: rowCreate(field: "name" = "Text file.txt"; field: "filestring" = $text)
text: "Some text"
By default, V5 does not install an MTA agent to handle sendmail!
To ensure email deliverability, we recommend connecting an external SMTP server with configured DNS. Or you can set up your own SMTP according to this guide
SMTP connection is individual for the schema:
Fill in the custom_smtp_setings_for_schema
field in the Settings
table.
Fill it as an array:
{
"host": "ssl://smtp.gmail.com",
"port": 465,
"login": "totum@totum.online",
"password": "password_here"
}
Be sure to check the instructions for your SMTP!
By default, emails are sent from the address no-reply@HOST
, but if you need to override this, it is done in the Settings
table.
To connect an SMTP server for all schemas on the server, you need to:
Open Conf.php
in the root of the installation for editing:
Comment out //
:
// use WithPhpMailerTrait;
Uncomment:
use WithPhpMailerSmtpTrait;
Uncomment and fill in the SMTP connection parameters (you need to specify your data):
protected $SmtpData = [
'host' => 'YOUR_HOST_HERE',
'port' => 'YOUR_PORT_HERE',
'login' => 'YOUR_LOGIN_HERE',
'pass' => 'YOUR_PASS_HERE',
];
In this case, the settings in
custom_smtp_setings_for_schema
do not apply.
Available in sections: Action Code.
=: notificationSend(users: ; title: ; ntf: ; eml: ; custom: )
Sends an internal notification (using the admin_text
code), an email (using the eml_email
template), and executes custom code whose name is specified in custom
.
To send an
Required parameters
users β a single number or a list of user IDs.
title β the notification title.
Optional parameters (at least one must be specified)
ntf β string, the text of the internal notification.
eml β string, the text of the email notification.
custom β custom: "name" = "text or html"
. Multiple parameters.
ttm__custom_user_notific_codes
table.$#user
, $#title
, and "text or html"
in the variable $#html
.users
in ssh: true
mode (in separate processes).EXAMPLES
= : notificationSend(users: $list_users; title: "some title"; ntf: "some notif text"; eml: "some email text")
list_users: listCreate(item: 19; item: 32)
Available in sections: Cell Formatting cell.
=: setFormat(condition: ; block: ; color: ; bold: ; background: ; decoration: ; italic: ; progress: ; progresscolor: ; icon: ; text: ; hide: ; showhand: ; placeholder: )
Changes the appearance of a cell based on the condition:
.
The function's results are applied to the cell sequentially, according to the indices f1=:
, f2=:
, f3=:
and so on.
setFormat
takes precedence over setRowFormat when formatting conditions overlap.
Optional Parameters
condition β the triggering condition in the format condition: "left_part" = "right_part"
.
condition:
evaluates to false
, neither subsequent condition
nor parameters will be calculated.block β cell lock.
true
β locked.false
β unlocked.color β cell text color.
#ff00cc
.tomato
.bold β bold text in the cell.
true
β bold.false
β normal.background β cell background color.
#ff00cc
.tomato
.decoration β string, text decoration.
underline
β underlined.line-through
β strikethrough.italic β italic text in the cell.
true
β italic.false
β normal.progress β length of the text highlight in the cell.
0
β no highlight.100
β full text highlight.progresscolor β color of the text highlight in the cell.
#ff00cc
.tomato
.text β displays the specified text, replacing the cell's value display. Does not affect the data stored in the cell.
icon β displays an icon to the left of the cell's value.
fontawesome 4
without the fa-
prefix. For example: shower
.comment β adds an i
icon to the cell, which shows the comment text when hovered over.
hide β multiple parameter, hides the field in the panel, mobile interface, or form.
"panel" = true
β hides the field in the panel without excluding it from the field position calculation in columns. By passing hide: "panel" = false
, the field can be displayed."extpanel" = true
β hides the field in the panel and excludes it from the field position calculation in columns. In this case, the field cannot be dynamically displayed after the panel is opened."mobile" = true
β hides the field in the mobile interface."form" = true
β hides the field in forms.tab β sets the left indent in the cell for the value or its display.
align β alignment of the value or display in the cell.
center
β centered.right
β right-aligned.editbutton β if true
, a button is displayed in the field to open it for editing.
showhand β if false
, the indication of manual value presence will be hidden in calculated fields with manual values.
placeholder β string, placeholder for an empty field opened for editing.
expand β if false
, disables the ability to expand a folder in tree-view.
textasvalue β if true
, the value in text
will be copied and displayed in the context panel as the field value.
To enable sorting in the column header by these values, specify the value type and the decimal separator for numbers:
textasvalue: "num"
or textasvalue: "str"
textasvalue: "num|."
or textasvalue: "num|,"
f1=: setformat(bold: true; color: "tomato")
f2=: setformat(condition: $#nfv != ""; block: true)
//Result:
Available in sections: Formatting row.
=: setRowFormat(condition: ; block: ; blockdelete: ; blockorder: ; blockduplicate: ; color: ; bold: ; background: ; decoration: ; italic: ; :)
Setting row formatting based on condition
.
The function's results are applied to the table sequentially, according to the indices f1=:
, f2=:
, f3=:
etc.
setRowFormat
takes precedence over setTableFormat when conditions overlap.
Optional parameters
condition β the triggering condition in the form condition: "left_part" = "right_part"
.
condition
evaluates to false
, subsequent condition:
will not be calculated, and parameters will not be applied.block β blocking changes in the row, including deletion, movement, and duplication.
true
β blocked.false
β unblocked.color β text color of the row.
bold β bold text in the row.
true
β bold.false
β unblocked.background β background color of the row.
decoration β text decoration for the entire row.
underline
β underlined.line-through
β strikethrough.italic β italic text in the row.
true
β italic.false
β normal.blockdelete β blocking row deletion.
true
β blocked.false
β unblocked.blockorder β blocking sorting by n
.
true
β blocked.false
β unblocked.blockduplicate β blocking duplication.
true
β blocked.false
β unblocked.rowcomment β string, supports html. Comment in the row control buttons. For example, to explain the reason for blocking deletion.
Available in sections: Table Formatting.
=: setTableFormat(condition: ; blockdelete: ; blockadd: ; blockorder: ; blockduplicate: )
Formatting conditions applied to the entire table, including header and footer.
Optional parameters
condition β trigger condition of the form condition: "left_part" = "right_part"
.
condition
evaluates to false
, the subsequent condition:
parameters will not be considered.block β blocks changes in the table, including deletion, movement, and duplication.
true
β blocked.false
β unblocked.blockdelete β blocks row deletion.
true
β blocked.false
β unblocked.blockduplicate β blocks duplication.
true
β blocked.false
β unblocked.blockorder β blocks sorting by n
.
true
β blocked.false
β unblocked.blockadd β blocks adding rows to the table.
true
β blocked.false
β unblocked.
hideadd β true
if you need to remove the Add button specifically, but leave the add button through the Panel.
tabletitle β string, displayed table title.
rowstitle β string, displayed title of the row part of the table.
fieldtitle β multiple name-parameter, displayed field title, set in the format fieldtitle: 'field_name' = "Title"
tabletext β string, text displayed under the table description.
tablehtml β string, html displayed under the table description.
tablecomment β string, text displayed under the prefilter.
buttons β list of name
fields of buttons, located in the header or footer for their visual display in the row part buttons.
Creator
, the buttons remain in their placement location and sort
with an additional B
mark.dotbuttons β list of name
fields of buttons, located in the header or footer for their visual display in the dot button in the lower right corner.
Creator
, the buttons remain in their placement location and sort
with an additional D
mark.extbuttons β list of name
fields of buttons, located in the header or footer for their visual display in the sandwich button next to the table title.
Creator
, the buttons remain in their placement location and sort
with an additional E
mark.printbuttons β list of name
fields of buttons, located in the header or footer for their visual display in the print dropdown menu at the top of the table.
Creator
, the buttons remain in their placement location and sort
with an additional P
mark.fieldhide β multiple name-parameter of the form fieldhide: 'field_name' = true
. Allows soft hiding of extra fields based on conditions β the user can display them.
true
β hides the field in field visibility management when the table loads.false
β shows the field in field visibility management when the table loads."force"
β will hide the field from the table and from field visibility management. fieldhide: 'field_name' = "force"
.fieldhide: 'id' = true
β disables the display of system id
rows.This is a soft block β the field data is still transmitted to the user's browser.
fieldshide β list of name
fields that will receive the force
signal (similar to the fieldhide
parameter) when the condition
is met and the false
signal when the condition
is not met.
browsertitle β replaces the title in the browser.
true
β takes the title from tabletitle
."string"
β you can pass a string if a title different from tabletitle
is needed.interlace β colors even and odd rows.
"3"
β percentage of shading for even rows. The higher the number in the passed string, the darker it is. Range 1-100
.
"tomato/beige"
β html colors for odd and even rows.
"/beige"
β you can set only one before or after /
."#343434/beige"
β instead of html colors, you can use HEX with #
.
topbuttons β false
if you need to hide the control buttons next to the table name.
hidedots β hidedots: "window" = true
or hidedots: "table" = true
to hide the dot button in the lower right corner in a pop-up window or table.
Available in sections: Table formatting.
=: setRowsOrder(ids: )
ids β list
of row id
s that need to be placed at the top of the table in the order the id
s are provided.
Can be used in conjunction with the quick variable $#rows
, available only in table formatting. The variable returns a list
considering pagination.
Available in sections: Table formatting.
=: setRowsHide(ids: )
ids β list
of row id
s to be hidden on the client side.
Reset
button for row part filters and works similarly to manual filtering by checkboxes.id
s in several functions, all passed ids will be hidden as a result.Can be used together with the quick variable $#rows
, available only in table formatting. The variable returns a list
considering pagination.
This function is also used in conjunction with the process variable $@proc_var
β the procVar function, which exists within the php process.
Example:
Hide the row with id=2
when the button is clicked.
Button action code:
= : procVar(name: "testProc"; value: json`[2]`)
Table formatting code:
f1=: setRowsHide(ids: $@testProc)
Available in sections: Table formatting.
=: setRowsShow(ids: )
ids β list
of row id
s to be shown on the client.
Reset
button for row filters and works similarly to manual filtering by checkboxes.id
s in multiple functions, all passed ids will be shown as a result.Can be used together with the quick variable $#rows
, available only in table formatting. The variable returns a list
considering pagination.
This function is also used in conjunction with the process variable $@proc_var
β the procVar function, which exists within the php process.
Example:
Hide the row with id=2
when the button is clicked.
Button action code:
= : procVar(name: "testProc"; value: json`[2]`)
Table formatting code:
f1=: setRowsShow(ids: $@testProc)
Available in sections: Formatting cell.
=: setFloatFormat(blocknum: ; nextline: ; maxwidth: ; fill: ; height: ; maxheight: ; glue: ; breakwidth: )
Sets adaptability parameters for fields located in the header and footer. Not applicable to the row part.
More about sections and adaptability.
Optional parameters
blocknum β number, determines the group number to which the field will be assigned. Fields in groups are glued together only if they are located next to each other. If you assign the same number to two fields that are separate, they will be two different groups with the same numbers.
nextline β if true
, the field will immediately be moved to the next line in the group.
maxwidth β number, if specified, determines the width in px
to which the field will expand if the screen width allows. If multiple fields in one line have this parameter, they will expand proportionally to their base width set in the field settings.
fill β true
, if specified, the field will expand to the maximum possible width of the block defined by the widest line.
height β number, the height of the field in px
. If specified, the field height will differ from the standard. The display of the field content will also change.
maxheight β number, the maximum height of the field in px
. If specified, the field will determine its height automatically depending on the content. But not more than the specified maximum height. Can be specified in vh
and css calc
.
glue β true
, glues the field to the one on its left. Glued fields will be moved together. They will not be moved at the minimum screen width.
breakwidth β number, determines the width at which the field will be moved. If not specified, the move will occur only when the field reaches the default width.
These same parameters can be set in the section settings as:
glue : field_name, else_field_name : true
ormaxwidth : block_number : 400
example: setFloatFormat(blocknum: 1; nextline: true; maxwidth: 400; fill: true; height: 200; maxheight: 400; glue: true)
Available in sections: Formatting fields.
=: panelButton(condition: ; code: ; text: ; icon: ; background: ; vars: ; refresh: )
Returns a section with a single button for the panel on the right mouse button. Works only with p
codes in cell formatting.
Buttons are placed one after another. First all button, then buttons.
When the button is called, the current environment is passed to it: $#ntn
, $#nci
, $#nth
, #id (and other lowercase fields)
.
Required parameters
code β string code that will be executed when the button is pressed. The name
of the field in the current table can be passed, from which the action code will be taken for execution. Required parameter.
code must be passed as a string
code: "....."
, the option where you refer to subsequent code does not work.
It can be passed in the following syntax:
p1=: panelButtons(button: $b100; refresh: true)
b100: rowCreate(field: "text" = "Button name"; field: "code" = $code)
```code:totum
=: set(table: 'table'; field: 'field' = $value)
value: "some_value"
```
In this case, the code inside the code
block is processed as text and its $
and $#
do not intersect with the current field code. :totum
means to highlight as totum code.
In code:
it is possible to pass the name
of another field in the current table, then the code will be taken from it from the corresponding code type.
Also in code
you can use the reference @table.field
or @table.field.key_field[key]
. In this case, if you click on @...
, a button will be shown that opens the target code for editing in a popup window.
Optional parameters
condition β trigger condition of the form condition: "left_part" = "right_part"
.
condition
is false
, then neither subsequent condition
nor parameters will be calculated.text β string button label.
icon β string fontawersome 4
icon name without fa-
.
background β string web color
name or HEX #ddd
.
vars β associative array with keys and values of variables that will be passed to the executed code.
refresh β true
, "recalculate"
and "reload"
.
EXAMPLES
p1=: panelButton(condition: $#nfv != ""; code: @table.field.id[$id]; text: "OPEN"; background: "orange"; refresh: true)
id: "..."
Available in sections: Formatting cell.
p1=: panelButtons(condition: ; button: ; button: ; buttons: ; refresh: true)
Returns a section with buttons for the panel on the right mouse button. Works only with p
codes in cell formatting.
Buttons are placed one after another. First all button, then buttons.
When a button is called, the current environment is passed to it $#ntn
, $#nci
, $#nth
, #id (and other lowercase fields)
.
Optional parameters
condition β if present, the function will only execute when it evaluates to true
. Multiple parameter.
button β associative array, multiple parameter, information about one button, format similar to linkToButtons.
buttons β list of associative arrays containing button settings.
refresh β true
allows the table to be refreshed after the button is executed. "recalculate"
allows the source table to be recalculated even if there were no changes in it. "reload"
β upon return, the source table will be reloaded as if the user pressed refresh in the browser.
Structure row
:
text
β string label on the button. Required parameter.
code
β string code that will be executed when the button is pressed. The name
of a field in the current table can be passed, from which the action code will be taken for execution. Required parameter.
code must be passed exactly as a string
code: "....."
, the option where you refer to subsequent code does not work.
It can be passed in the following syntax:
p1=: panelButtons(button: $b100; refresh: true)
b100: rowCreate(field: "text" = "Button name"; field: "code" = $code)
```code:totum
=: set(table: 'table'; field: 'field' = $value)
value: "some_value"
```
In this case, the code inside the code
block is processed as text and its $
and $#
do not intersect with the code of the current field. :totum
means to highlight as totum code.
In code
it is possible to pass the name
of another field in the current table, then the code will be taken from it from the corresponding code type.
icon
β string name of the fontawersome 4
icon without fa-
.
background
β string name of the web color
or HEX #ddd
.
vars
β associative array with keys and values of variables that will be passed to the executed code.
refresh
β allows specifying refresh for a specific button in the stack.
example: panelButtons(button: $b1; button: $b2; button: $b3)
b1: rowCreate(field: "text" = "OPEN"; field: "code" = @table.field_vith_code; field: "vars" = $vars; field: "refresh" = true)
b2: rowCreate(field: "text" = "IFRAME"; field: "code" = "field_name_in_table"; field: "vars" = $vars; field: "refresh" = false)
~vars: rowCreate(field: "field_value" = #field_value)
b3: rowCreate(field: "text" = "DELETE"; field: "code" = $code; field: "refresh" = true)
```code:totum
=: delete(table: $#ntn; where: 'id' = #id)
```
// text and code are required parameters, the rest are not.
Available in sections: Cell Formatting.
=: panelHtml(condition: ; html: )
Adds html to the panel via right-click. Works only with p
codes in cell formatting.
Required parameters
Optional parameters
true
. Multiple parameter.Available in sections: Cell formatting.
=: panelImg(condition: ; img: )
Adds an image to the panel via right-click. Works only with p
codes in cell formatting.
Mandatory parameters
Optional parameters
true
. Multiple parameters allowed.example: panelImg(img: #file[0][file])
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: jsonCreate(data: ; field: "" = )
Returns one string in json format.
Optional parameters
data β data of any format.
field β multiple, key and value for adding to the generated json. If the key is not in data
, it will be added; if it is, it will be overwritten with the new value.
flag - ESCAPED_UNICODE
or PRETTY
.
example: jsonCreate(data: $data; field: "c" = 3; field: "b" = 4)
data: rowCreate(field: "a" = 1; field: "b" = 2)
// Result: {"a":1,"b":4,"c":3}
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: jsonExtract(text: )
Returns data from a json string or null
if the string format is not json.
Required parameters
example1: jsonExtract(text: "[1,2,3,4]")
// Result - list of values 1,2,3,4
SYNTACTIC ANALOG:
example2: json`[1,2,3,4]`
// Result - list of values 1,2,3,4
Can also be used directly in a function:
example3: if(condition: json`[1,2,3,4]` = 3; then: true; else: false)
// Result - true
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: fileGetContent(file: )
Returns the content of a file in the current transaction.
Required parameters
#file_field[0][file]
.example: fileGetContent(file: #file_field[0]["file"])
//Result: content of the requested file
//Exception: if the file is missing - "File [[$fname]] does not exist on the disk"
Available in sections: Action Code
=: normalizeN(table: ; num: )
Returns null
.
Performs normalization of the n-field
in a simple table sorted by n
. Assigns integer values to n
.
Service function. If a simple table with n-sorting frequently experiences the insertion of new rows between existing ones, it is advisable to set its normalization on a cron.
Mandatory parameters
table β name of the table.
num β the maximum number of decimal digits in the n
values, upon reaching which normalization should be performed. Recommended value is 12.
example: normalizeN(table: 'table_name'; num: 12)
//Result: all values of the n field in the table table_name will be reassigned to integers in the order of the n field
During
n
normalization, the unit recalculation is not executed. If fields in rows refer to#n
, they will not be recalculated!
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: sysTranslit(str: )
Returns a transliterated string with spaces replaced by _ and non-alphanumeric characters removed.
Required parameters
example: sysTranslit(str: "ΠΠ°ΠΌΠ° ΡΠ°ΠΌΠ°")
//Result: mama_rama
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: getTableSource(table: ; cycle: ; hash: ; fields: ; id: )
Returns a row from the full table data.
For simple tables, it exports deleted rows only if is_del
is in the fields.
For cycle tables, it exports all cycle tables for each requested row.
Required parameters
Optional parameters
cycle β number, single or list, determines the cycle if the table
is a calculated in cycle table.
hash β string, for temporary tables the hash of the table.
id - single or list id of the rows to be exported. Only for non-calculated tables.
fields - fields to be exported. Only for non-calculated tables.
example: getTableSource(table: 'globcalcs_test_table')
// Result: {
// "rows": {
// "1": {
// "_E": true,
// "id": 1,
// "test1": {
// "v": "1"
// },
// "dannie": null,
// "is_del": true,
// "testmd5": null
// }
// },
// "nextId": 8,
// "params": {
// "test": {
// "v": "37"
// }
// }
//}
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: getTableUpdated(table: ; cycle: )
Technical function. Returns row
from the update code parameters of the specified table.
Mandatory parameters
Optional parameters
table
is calculated in a cycle.Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: logRowList(table: ''; cycle: ; id: ; field: ; params: ; limit: )
Returns data from the built-in logging system as a list of arrays.
Required parameters
field β name-parameter field in the table
.
table β name-parameter name of the table from which the data is taken.
Optional parameters
id β id
of the row in the row part. Required if field
is specified from the row part.
cycle β defines the cycle if the table
is calculated in the cycle.
params β passed as a list of fields. If not passed, all fields are returned.
comment
β change commentdt
β date and time of change in the format Y-m-d H:i:s,user
β user idaction
β type of action
1
β Addition2
β Modification3
β Reset to calculated4
β Deletion5
β Pin6
β System7
β Restorationvalue
β value after changelimit β this is a number
, the number of recent changes.
0
or ""
, it will be disabled!Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: tableLogSelect(from: ; to: ; users: ; order: )
Returns rowList
from the user action logging table.
Required parameters
from β date from in the format Y-m-d
.
to β date to in the format Y-m-d
.
users β list of user id
s.
Optional parameters
order β name-parameter field in the internal logging system by which sorting will be performed.
order
parameters are specified, sorting will be performed sequentially.Available in sections: Action Code.
=: tableLog(table: ''; cycle: ; id: ; field: ; comment: )
Allows you to make an arbitrary entry in the Log for a field. For example, if you have a cycle during which the field values change several times, but you need to record only the final change.
Required parameters
table β name-parameter name of the table.
field β name-parameter field in the table
.
Optional parameters
cycle β defines the cycle if the table
is calculated in a cycle.
id β id
of the row if field
defines a field in the row part.
comment β string, a comment that will be recorded in the log.
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: userInRoles(role: )
Returns true
or false
depending on whether the user has a role listed in role
.
Necessary to use if you are using user role binding and plan to export the solution through Table Export/Import (partial solution export).
When exporting and importing to another installation through Table Export/Import, the role numbers specified in this function will be replaced with the role numbers in the target schema to which the import is being made.
Mandatory parameters
id
of the role.Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: getUsingFields(table: ; field: )
Returns a list of tables with fields that use the given table field. The data is taken from the data field in the Table Composition.
When saving field settings, data about the fields of tables used in this field is added to the data field:
When using functions in name fields with the specified table name
In parameters with $#
Referencing via @table_name.field_name is currently not caught
Mandatory parameters
table
.example: getUsingFields(table: 'settings'; field: 'code')
//Result: {"0":{"name":"do_it_now","version":null,"table_name":"settings"}}
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: tableUrl(table: ''; cycle: )
Returns the full path to the table with the HTTPS protocol.
Required parameters
Optional parameters
cycle β number, one, defines the cycle if the table table:
is calculated in the cycle.
protocol β "http"
if you need to output a link with http
instead of https
.
EXAMPLES
example: tableUrl(table: 'table_name'; cycle: $#nci; protocol: "http")
Available in sections: Action Code.
=: sleep(sec: )
Creates a pause in the execution of the action for the specified number of seconds.
Mandatory parameters
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: isItPro()
Returns true
if the version is PRO.
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: xmlExtract(xml: ; attrpref: "__"; textname: "TEXT")
Returns a Totum object containing the contents of the XML.
Required parameters
xml β the content of the XML file to be processed.
attrpref β prefixes for attributes. If set to ""
, they will not be added. If any other characters are specified, they will be added before the attribute names.
<TEST><TOWN index="37" sname="Moscow" latitude="56" longitude="38"/></TEST> with the specified prefix __ and conversion to JSON will be ==>
{"TEST":{"TOWN":[{"__index":"37","__sname":"Moscow","__latitude":"56","__longitude":"38"}]}}
Optional parameters
textname β if there is text inside the tags, this text will be placed in an element with the name specified in this parameter.
<TEST><TOWN>Text in tag</TOWN></TEST> with the specified prefix TEXT and conversion to JSON will be ==>
{"TEST":{"TOWN":[{"TEXT":"Text in tag"}]}}
Only for PRO version
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: execSSH(ssh: ; vars: )
Returns the full response of the SSH command as text.
When installed in the root folder of the Totum installation, a Conf.php
is created, in which by default execSSHOn
is set to 'inner'
. To unlock execSSH, it needs to be set to true
:
protected $execSSHOn = 'inner'; β> protected $execSSHOn = true;
The home directory for execSSH is the folder that nginx points to!
Required parameters
Optional parameters
vars β list or associative array.
If a list is passed, all elements of the list will be passed through a space in single quotes and with escaping.
If vars: is an associative array, parameters of the form key='value'
with escaping inside value
will be appended to the command.
example1: execSSH(ssh: "php -v")
//Result: PHP 7.1.28 (cli) (built: Apr 9 2019 11:24:32) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
example2: execSSH(ssh: "python ./python_script"; vars: $vars)
vars: rowCreate(field: "key_1" = "value_1"; field: "key_2" = "value_2")
// The ssh command executed will be $ python ./python_script key_1='value_1' key_2='value_2'
Only for PRO version
Available in sections: Action Code and Code.
=: linkToAnonymTable(table: 'tmp_table_name'; data: $rowList; params: $row)
Returns an encrypted url
for calling a temporary table with pre-filled data for an unauthorized user.
For anonymous access to the table to work, the user anonym
must be enabled, from which actions will be performed. This user must be assigned a role that has the appropriate access (edit/view) to the displayed table.
Examples of anonymous tables: https://start.demo.totum.online/An/30 and https://start.demo.totum.online/An/52
Required parameters
Optional parameters
data β list of associative arrays to add rows to the returned table. Similar to linkToDataTable.
params β associative array to fill in the header and footer fields of the returned table. Similar to linkToDataTable.
protocol β default is https
. Can be overridden to http
.
target β if set to iframe|blank|self|parent|top
, the link will be followed similarly to linkToScript
.
example: linkToAnonymTable(table: 'tmp_anonym_table'; params: $row)
row: rowCreate(field: "order_id" = 1111)
//Result: htts://test.demo.totum.online/An/444?d=Y4EK1mpzeZtzxRcB58aMBQ06jVAtzVVU9A6bUo3oJbIP04JcHs7fdnD%2B9HCrh%2F4TUS9R0E4BLjfPXZ3slG%2FQgjJqGkheCb%2B8Hm53neuqHq2bbxdd5a2sjOIEBBvmnFES
If the table in the header or footer contains fields with name
: h_get
, h_post
or h_input
, then the data passed in get/post/post-raw
when requesting the table will be substituted there.
get
and post
β associative arrays, so it is recommended to use the data field type for h_get
and h_post
.
input
β string.
Only for PRO version
Available in sections: Action Code and Code.
=: linkToForm(path: "path-to-form"; params: $row)
Returns an encrypted url
to call a form with pre-filled data for an unauthorized user.
Mandatory parameters
Optional parameters
params β row in the format params: $row
with field values that should be filled when following the generated link.
protocol β default is https
. Can be overridden to http
.
target β if set to iframe|blank|self|parent|top
, the link will be followed similarly to linkToScript
.
Only for PRO version
Available in sections: Action Code and Code.
=: linkToQuickForm(path: "path-to-form"; fields: $row; fixed: $row_fix; protocol: "https")
Returns an encrypted url
to call a quick form with pre-filled data for an unauthorized user.
Or performs a redirect if the target
parameter is specified.
Required parameters
Optional parameters
fields β a row in the format params: $row
with field values that should be pre-filled when following the generated link.
fixed β similar to fields
, but the fields will be locked for editing on the server side.
Both of these parameters use the auto-substitution mechanism of the add string, so in the target form table, they must be unlocked for editing when adding.
protocol β default is https
. Can be overridden to http
.
target β if specified as iframe|blank|self|parent|top
, a redirect will be performed similar to linkToScript
.
Only for PRO version
Available in sections: Action Code and Code.
=: encriptedFormParams(params: $row)
Returns a string with the encrypted parameter d
, which can be passed in get
when calling an external page with a form (inserted into this page as a js-script) to pass the necessary information into the form fields.
Optional parameters
row
to fill in the fields of non-string placements.Available in sections: Code; Action Code; Select Code; Cell formatting, row, table.
=: proDbConnect(name: )
PRO Database Access Opens a connection to an external database. Returns the connection hash
.
Mandatory parameters
ttm__external_databases
tableAvailable in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: proDbDisconnect(hash: )
PRO Database Access. Closes the connection to an external database. PRO Database Access
If this function is not executed, the connection will be closed automatically at the end of the process.
Mandatory parameters
proDbConnect
.Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: proDbExecQuery(hash: ; name: ; query: ""; params: $list)
PRO Database Access. Executes a query and returns the number of affected rows (in PDO
β rowCount
).
Required Parameters
Query
string. Parameter substitution using ?
can be used.Optional Parameters
?
in query
.One of the following must be provided
name β name of the connection in the ttm__external_databases
table. If name is provided, the connection will be opened at the beginning of the function execution and closed after its completion.
hash β string hash of the connection from the proDbConnect
function. If hash is provided, the connection will not be closed upon completion of the function.
Available in sections: Code; Action Code; Select Code; Cell formatting, row, table.
=: proDbSelect(hash: ; name: ; query: ""; params: $list)
PRO Database Access. Executes a Query
and returns the first row as a row
.
Required parameters
Query
string. Parameter substitution using ?
can be used.Optional parameters
?
in the query
.One of the following must be provided:
name β name of the connection in the ttm__external_databases
table. If name is provided, the connection will be opened at the start of the function execution and closed after its completion.
hash β string hash of the connection from the proDbConnect
function. If hash is provided, the connection will not be closed upon completion of the function.
Available in sections: Code; Action Code; Select Code; Formatting cell, row, table.
=: proDbSelectList(hash: ; name: ; query: ""; params: $list)
PRO Database Access. Executes a Query
and returns the result as a rowList
.
Required parameters
Query
string. Parameter substitution using ?
can be used.Optional parameters
?
in query
.One of the following must be provided:
name β name of the connection in the ttm__external_databases
table. If name is provided, the connection will be opened at the start of the function execution and closed after its completion.
hash β string hash of the connection from the proDbConnect
function. If hash is provided, the connection will not be closed upon completion of the function.
Available in sections: Code; Action Code; Select Code; Cell Formatting, Row Formatting, Table Formatting.
=: proPrefilteredIds(exclude: ; excludelist: )
PRO only.
Returns id
of rows limited by prefilters.
Note that in the
inner
channel all prefilters are equal to null!
Optional parameters
exclude β name-parameter excluding the prefilter from the calculation. Multiple parameter.
excludelist β list of name-fields for exclusion.
Available in sections: Action code.
=: proLinkToBuffer(text: )
Copies text to the computer's clipboard.
Required parameters
Available in sections: Action code.
=: proGetAuthorizationLink(user: ; timeout: ; table: ; type: )
Creates a single-use or multi-use token for system login.
For more details, see PRO Auth Links
Required parameters
user β user id
timeout β token validity period
60
β number of seconds from creation."2025-01-01 00:00"
β date until which the code is valid in the format Y-m-d H:i
.Optional parameters
table β name parameter, the table that will be opened when the link is followed.
type β single|multiple
. If not specified, then single
.
single
β the token is valid only once.multiple
β the token is valid until the timeout
expires.filter β multiple parameter, you can pass Pre-filter values.
Available in sections: Code; Action Code.
=: serviceXlsxGenerator(template: ; data: ; answertype: ; name: ; comment: ; pdf: false)
Returns filestring
, filestringRow
or filestringRowList
.
Only in PRO
More about generators in Services βΉ
Required parameters
template β technical name of the file on the Totum server.
#file_field[0][file]
β to get it from the File field.
"*NEW*"
β to use a blank template.
list
β if you need to create documents using different templates in one action.
${value}
β variables for replacement should be specified this way.
data β row
with keys for replacement.
Optional parameters
answertype β response type:
"filestring"
β by default, a binary is returned. Used when generating one file in a request."filerow"
β in this case, a ready row
with name
and filestring
keys will be returned. Name
must be specified in the name parameter. Used when generating one file in a request."filerowlist"
β in this case, a ready rowList
with name
and filestring
keys will be returned. Used when generating multiple files in a request.
name
β must be specified as list
in the name parameter.template
β can be specified as a single value or a list.data
β rowList
if you need to generate multiple files using one or more templates."filestringlist"
β in this case, a list
of filestring
will be returned. Rarely used when generating multiple files.name β a single value or list
. Used in conjunction with the response types filerow
and filerowlist
.
comment β comment for billing.
pdf β true
if the response needs to be returned in pdf
.
titles β used only in conjunction with *NEW*
in the template. Expects a list
with field titles for columns β they will be added automatically during generation.
Available in sections: Code; Action Code.
=: serviceDocxGenerator(template: ; data: ; answertype: ; name: ; comment: ; pdf: false)
Returns filestring
, filestringRow
or filestringRowList
.
Only in PRO
More about generators in Services βΉ
Required parameters
template β technical name of the file on the Totum server.
#file_field[0][file]
β to get from the File field.
list
β if you need to create documents using different templates in one action.
${value}
β variables for replacement should be specified this way.
data β row
with keys for replacement.
Optional parameters
answertype β response type:
"filestring"
β by default, a binary is returned. Used when generating one file in a request."filerow"
β in this case, a ready row
with keys name
and filestring
will be returned. Name
must be specified in the name parameter. Used when generating one file in a request."filerowlist"
β in this case, a ready rowList
with keys name
and filestring
will be returned. Used when generating multiple files in a request.
name
β must be specified as list
in the name parameter.template
β can be specified as a single value or a list.data
β rowList
if you need to generate multiple files using one or more templates."filestringlist"
β in this case, a list
of filestring
will be returned. Rarely used when generating multiple files.name β a single value or list
. Used with response types filerow
and filerowlist
.
comment β comment for billing.
pdf β true
if the response needs to be returned in pdf
.
Available in sections: Code; Action Code.
=: serviceXlsxParser(file: ; withformats: ; withcolumns: )
Only in PRO
Returns a rowlist of data contained in the .xlsx
file sent to the Service.
Mandatory parameters
file
key of the File type field.or (you need to use one of these parameters)
Optional parameters
withformats β if true
, returns some formatting parameters for the cell. Returns information on:
bold
italic
underline
color
background
withcolumns β if true
, a row with the column letter designation will be added.
comment β a comment for the service logging system.