Available functions
Page contains content of all embedded functions. Functions can be used e.g. for:
- initial processing parameters (e.g. form action)
- creating call conditions (e.g. validators)
In each of the function parameters a constant, variable ( $ ) or other function can be used ( variable_id#function_name() ) eg:
#round( #sum( [$var1, $var2] ), 2)
General use
General functions used for different sort of data.
Name | Description | Function variants |
| Checks if given values are equal. | eq(v1, v2) : boolean v1 First value (any) v2 Second value (any) Result: True if both values are equal // equal eq( 1, 1.00 ) eq( "text", "text" ) // not equal eq( 1, 1.01 ) eq( "text", "text" ) |
ieq | Checks if given parameters are equal. Ignores case size in case of text. | ieq(v1, v2) : boolean v1 (string) First value (any) v2 (string) Second value (any) Result: True if both given texts are equal ignoring the case size of text. equal ieq( "text", "text" ) // not equal ieq( "text", "text" ) |
empty | Checks if given value is empty or have one empty element. | empty(value) : boolean value Any type value is checked. Result: True if value is empty or have one empty element. // empty empty( "" ) empty( [] ) empty( $var1 ) empty( [""] ) empty( [null] ) // not empty empty( "text" ) empty( [1, 2] ) |
anyEq | Checks if any value from the list is equal to given value. | anyEq(v1[], v2) : boolean v1[] Any table with values. v2 Any same type value like value from v1 table. Result: True if any value from v1 table equals v2 Example // true anyEq([1,2],1) anyEq([3,2,1],1) anyEq([1],1) // false anyEq([3,2,1],5) |
Text
Functions for working with text
Name | Description | Function variants |
| Concatenates given text fragments. | concat(strings) : string strings (string[]) An array containing text fragments. Result: Text created from combination of the given fragments // returns "text" concat(["te", "xt"]) |
| Combines the given text fragments using the given separator. Update from version 3.2.48 - added support for new parameter types (numbers, logical values, dates, dates with time) | join(fragments, [separator] ) : string fragments (object[]) Table containing text fragments / numbers / logical values / dates / dates with time separator (string) The character by which all fragments will be combined. Default " " (space). Result: The text was created by combining the given fragments with a separator // returns "Jan Kowalski" join(["Jan", "Kowalski"]) // returns "1;2;3" join([1, 2, 3], ";") // returns ";" join(["", ""], ";"); // returns "2;;3" join([2,null,3], ";"); |
| Changes first character of given text to capital letter. | capitalize(text) : string text (string) Initial text Result: Text with first character in capital letter. // returns "Text" capitalize("text") |
| Replaces all characters in the given text with lowercase letters. | lowerCase(text) : string text (string) Initial text Result: Text saved in lowercase letters. // returns "text" lowerCase("TEXT") |
| Replaces all characters in the given text with uppercase letters. | upperCase(text) : string text (string) Initial text Result: Text saved in uppercase letters. // returns "Tekst" lowerCase("tekst") |
| Returns the text created by extracting a part of the given text according to the parameters. | substring(text, start, [length]) : string text (string) Initial text start (integer) Initial index length (integer) [opcjonalny] The length of the extracted sub-text (by default to the end of the initial text). Result: Text that is a part of the initial text. // returns "ext" substring("text", 1)// returns "ex" substring("text", 1, 2) |
| Checks whether the given text matches the given regular expression. | matchesRegex(text, regexp) : boolean text (string) Checks the text. regexp (string) Regular expression that the text must meet. Result: True if the given text matches the given regular expression. // matches matchesRegexp("text", "t.*")// not matches matchesRegexp("text", "t") |
| Replaces all occurrences of the given text in the initial text. | replace(text, pattern, replacement) : string text (string) Initial text pattern(string) Pattern replacement (string) Replacement Result: Text with all occurrences of the pattern replaced in the initial text. // returns "Today is 2016-01-01" replace("Today is date_","_date_", #currentDate()) |
| Replaces all occurrences of the text that match the given regular expression in the initial text. | replaceRegexp(text, regex, replacement) : string text (string) Initial text regex(string) Regular expression replacement (string) Replacement Result: Text with all matching occurring regular expression instances replaced in the initial text. // returns "XbcXe" replaceRegexp("abcde", "[ad]", "X") |
| Removes all whitespaces from the beginning and end of the given text. | trim(text) : string text (string) Initial text Result: Initial text with removed whitespaces from the beginning and the end of the given text. // returns "sample text" trim(" sample text ") |
| Returns an empty string. | emptyString() : string Result: Text in the form: "" // returns empty string emptyString() |
| Formats the number by the given separators and the number of decimal places. | format(value, decimalLen, decimalSeparator, thousandSeparator) : string value (float/integer) Numerical value to be formatted. decimalLen (integer) Number of decimal places decimalSeparator (string) Decimal separator thousandSeparator (string) Thousand separator (in the case of an empty string, the separator will not appear) Result: Formatted numerical value in text form. // returns "9 999,1230" format(9999.123, 4, ",", " ") // returns "9,999.1230" format( 9999.123, 4, ".", "," ) // returns "10000" format(10000.123, 0, ",", "") // returns "149,13" format(149.125, 2, ",", " ") |
formatText | Formats a string of characters by the given schema | formatText(schema, parameters, [customRegex]) : string schema (string) A schema in which consecutive characters # (or given as an optional customRegex parameter) will be replaced by subsequent characters from parameters. parameters (string[]) Text parameters whose subsequent characters will be entered into the schema. customRegex (string) Parameter that changes the "#" character in the schema by default, to any other Result: A character string formatted according to the schema // returns AAA-BBB-123 formatText("###-BBB-###", ["AA", "A123"])// returns #1234BB formatText("#ZZZZZZ", ["1234BB"], "Z") |
substringLast | Returns the last n characters of the string | substringLast(s, nChars) : string s(string) The initial text value. nChars(integer) Number of characters. Result: A string of defined length or shorter if the original string is shorter than the desired number of returned characters (then the function returns the original string). // returns cd substringLast("abcd", 2)// returns ab substringLast("ab", 3) |
length
| Returns the lenght of the given text | length(text) : integer text(string) Text Result: Text lenght Example // returns 0 length(null) length("")// returns 11 length("text - text") |
indexOf | Returns the occurrence number of the character string in the given text. Searches from the beginning to the end of the given text. If not found, then returns -1; First position in the text have index 0 | indexOf(text,searchText) : integer indexOf(text,searchText,start) : integer text(string) Text to be searched searchText(string) Search string start(integer) Initial position - position in the text from which the search should start Result: Text lenght Example // returns 3 indexOf("Alice have a cat, cat have alice and all ends with a happy end”.”al")// returns 2 indexOf("Alice have a cat, cat have alice and all ends with a happy end.","al",30) |
lastIndexOf | Returns the occurrence number of the character string in the given text. Searches from the beginning to the end of the given text. If not found, then returns -1; First position in the text have index 0 | lastIndexOf(text,searchText) : integer lastIndexOf(text,searchText,start) : integer text(string) Text to be searched searchText(string) Search string start(integer) Initial position - position in the text from which the search should start Result: Text lenght
Example // returns 30 lastIndexOf("Alice have a cat, cat have alice and all ends with a happy end.","al")// returns 1 lastIndexOf("Alice have a cat, cat have alice and all ends with a happy end.","al",10) |
split | Separates text into arrays with the given pattern (text or regular expression) | split(text,regexp):string[] text(string) Initial text regex(string) Pattern (regular expression or text)
Example // returns ["Ala has a cat" , "cat has ale"] split("ala has a cat, cat has ale",",")// returns ["Ala" , "cat, cats" , "ale"] split("Ala has cat, cat has ale","has")// returns ["Ala", "Ewa", "Marta"] split("Ala12423423Ewa1234Marta","\d+") |
newLine | Inserts a newline character | newLine() : string Result: Text in the form: "\r\n"
// returns newline character newLine() |
Mathematical
Functions for performing mathematical operations.
Name | Description | Function variants |
| Calculates the absolute value from the given number. | abs(value) : integer|float |
value (|integer|float) Any number Result: Absolute value from the given value //returns 1.23 sum( -1.23 ) | ||
calc | Calculates the result of a mathematical operation. | calc(num1, operator, num2) : integer|float |
num1 (integer|float) Any number operator (string) Operator:
num2 (integer|float) Any number Result: Result of operation in accordance with the given operator // addition expr( 2, '+', 2 ) // subtraction expr( 2, '-', 2 ) // multiplication expr( 2, '*', 2 ) // division expr( 2, '/', 2 ) | ||
le | Checks whether the number is less than or equal to the specified number. | le(num1, num2) : boolean |
num1 (integer|float) Any number num2 (integer|float) Any number Result: True if number num1 is less or equal than the number num2. // 'false' le(11, 10) // 'true' le(10, 10) // 'true' le(9, 10) | ||
lt | Checks whether the number is less than the specified number. | lt(num1, num2) : boolean |
num1 (integer|float) Any number num2 (integer|float) Any number Result: True if number num1 is less than number num2. // 'false' lt(11, 10) // 'false' lt(10, 10) // 'true' lt(9, 10) | ||
ge | Checks whether the number is greater than or equal to the specified number. | ge(num1, num2) : boolean |
num1 (integer|float) Any number num2 (integer|float) Any number Result: True if number num1 is greater than or equal to the number num2. // 'true' ge(11, 10) // 'true' ge(10, 10) // 'false' ge(9, 10) | ||
gt | Checks whether the number is greater than the specified number. | gt(num1, num2) : boolean |
num1 (integer|float) Any number num2 (integer|float) Any number Result: True if the number num1 is greater than the number num2. // 'true' gt(11, 10) // 'false' gt(10, 10) // 'false' gt(9, 10) | ||
| Rounding up. Returns the smallest integer greater than or equal to the specified number. | ceil(value) : integer |
value (float) Rounded number Result: The smallest integer greater than or equal to the specified number. //returns 3 ceil( 3 ) ceil( 2.11 ) | ||
| Rounding down. Returns the largest integer less than or equal to the specified number. | floor(value) : integer |
value (float) Rounded number Result: The smallest integer less than or equal to the specified number. //returns 2 ceil( 2 ) ceil( 2.65 ) | ||
| Rounds a number to the given number of decimal places. | round(value, [places]) : float |
value (float) Rounded number places (integer) [opcjonalny] The number of decimal places to which it rounds off. By default, rounding to the integer part (0). Result: The number is rounded to the given number of decimal places //returns 12 round( 12.236 ) //returns 12.24 round( 12.236, 2 ) | ||
| Returns the smallest of the given numbers. | min(numbers) : integer|float |
numbers (integer[]|float[]) Array of numbers Result: Returns the smallest of the given numbers. //returns 1 min( [1, 10, 5] ) | ||
| Returns the largest of the given numbers. | max(numbers) : integer|float |
numbers (integer[]|float[]) Array of numbers Result: Returns the largest of the given numbers. //returns 10 min( [1, 10, 5] ) | ||
| Returns the sum of all given numbers. | sum(numbers) : float |
numbers (integer[]|float[]) Array of numbers Result: Returns the sum of all given numbers. //returns 6 sum( [1, 10, -5] ) | ||
| Checks whether any number from the array is less than or equal to the specified number. | anyLe(num1[], num2) : boolean |
num1[] (integer|float) Any array of numbers num2 (integer|float) The number of the same type as the numbers in the table num1 Result: True weather any number from num1 is less than or equal to the number num2. // returns true anyLe([1,2,3],1) anyLe([0,2,3],1) // returns false anyLe([2,2,3],1) | ||
| Checks whether any number from the array is less than the specified number. | anyLt(num1[], num2) : boolean |
num1[] (integer|float) Any array of numbers num2 (integer|float) The number of the same type as the numbers in the table num1 Result: True weather any number from num1 is less than the number num2. // returns true anyLt([0,2,3],1) // returns false anyLt([1,2,3],1) anyLt([2,2,3],1) | ||
| Checks whether any number from the array is greater than or equal to the specified number. | anyGe(num1[], num2) : boolean |
num1[] (integer|float) Any array of numbers num2 (integer|float) The number of the same type as the numbers in the table num1 Result: True weather any number from num1 is greater than or equal to the number num2. // returns true anyGe([1,2,3],1) anyGe([2,2,3],1) // returns false anyLt([0,0,-1],1) | ||
| Checks whether any number from the array is greater than the specified number. | anyGt(num1[], num2) : boolean |
num1[] (integer|float) Any array of numbers num2 (integer|float) The number of the same type as the numbers in the table num1 Result: True weather any number from num1 is greater than number num2. // returns true anyLt([1,0,3],1) // returns false anyLt([1,0,1],1) anyLt([0,0,-2],1) |
Logical
Logical operators are useful primarily in the conditions of launching an action, validator, etc.
Complex conditions can be created thanks to those operators, e.g. the condition value of the variable 'var1' is equal to 'yes' or the value of variable 'var1' is equal to 'no' and simultaneously the value of the variable 'var2' is equal to 'yes':
#or( #eq( $var1,
"yes" ), #and(
#eq( $var1, "no” ), #eq( $var2,
"yes" ) ) )
Name | Description | Function variants |
| Returns the negation of the passed parameter. | not(value) : boolean |
value (boolean) Logical value Result: Returns the negation of the passed parameter. //returns false not( true ) | ||
| The logical ratio returns true if all passed parameters are true. | and(values) : boolean |
values (boolean[]) Array of logical values Result: Returns the logical ratio of all passed values //returns true and( true, true ) //returns false and( false, true ) //returns false and( false, false ) | ||
| The logical sum returns true if at least one of the passed parameters is true. | or(values) : boolean |
values (boolean[]) Array of logical values Result: Returns the logical sum of all passed values. //returns true or( true, true ) //returns true or( false, true ) //returns false or( false, false ) |
Date and time
Functions for date and time processing.
Name | Description | Function variants |
| Returns the current year | currentYear() : integer
Result:
Full year e.g. 2017. |
| Calculates the difference in days between two dates.
| calculateDaysDifference() : integer
firstDate (date)
First date
secondDate (date)
Second date
includeFreeDays (boolean)
Including holidays. If we include holidays, the difference will be greater by the number of days off between dates (including those dates). This function takes into account the system parameter "CustomHolidays". This parameter contains a list of additional free days separated by a semicolon ( ; ). The dates can be entered in full (2018-05-02) or abbreviated form (05-02). for example: 2018-05-02;05-04
Result:
Number of days resulting from a two-sided closed interval determined by two dates. Since the interval is closed on both sides, if two adjacent days fulfilling the criterion are given, the function returns the value 2. |
| Returns the current date. | currentDate() : date Result: Current date. //returns current date. //np. 2016-01-01 currentDate() |
| Returns the current date and time. | currentDateTime() : datetime Result: Current date and time. //returns current date and time. //np. 2016-01-01 12:30:45 currentDateTime() |
| Formats the given date to a text form according to the given format. | formatDate(date, format) : string date (date|datetime) Formatted date. format (string) Date format. Embedded formats are available:
Result: Current date and time. // 2015-12-31 12:33:44 //returns "2015-12-31" formatDate(#currentDateTime(), "date") |
| Calculates the date based on the parameters provided. Allows you to add / subtract from the given date years, months, days, etc. | calcDate(date, interval, unit) : date date (date) Base date interval(integer) The period of time that will be added / removed from the given date unit (string) Time unit, one of:
Result: Calculated date // 2015-12-31 //returns 2015-12-32 calcDate(#currentDate(), 1, "day"); //returns 2014-12-32 calcDate(#currentDate(), -1, "y"); |
| Calculates the date and time based on the parameters provided. Allows you to add / subtract from the given date years, months, days, hours, minutes etc. | calcDateTime(date, interval, unit) : datetime date (datetime) Base date interval(integer) The period of time that will be added / subtracted from the given date unit (string) Time unit, one of:
Result: Calculated date // 2015-12-31 12:33:44 //returns 2015-12-32 12:33:44 calcDate(#currentDateTime(), 1, "day"); //returns 2014-12-32 12:33:44 calcDate(#currentDateTime(), -1, "y"); |
le | Checks whether the date transferred in the first parameter is less than or equal to the date transferred in the second parameter | le(date1, date2) : boolean date1 (date/datetime) First date to be compared date2 (date/datetime) Second date to be compared Result: True or false
// data1 is LocalDate object with value "2016-12-24" // data2 is LocalDate object with value "2016-12-24" // returns true le(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDate object with value "2016-12-24T12:35:22" // returns true le(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDate object with value "2016-12-24T12:35:23" // returns true le(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDate object with value "2016-12-24T12:35:21" // returns false le(data1, data2)
|
lt | Checks whether the date transferred in the first parameter is less than the date passed in the second parameter | lt(date1, date2) : boolean date1 (date/datetime) First date to be compared date2 (date/datetime) Second date to be compared Result: True or false // data1 is LocalDate object with value "2016-12-24" // data2 is LocalDate object with value "2016-12-24" // returns false lt(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:22" // returns false lt(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:23" // returns true lt(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:21" // returns false lt(data1, data2) |
ge | Checks whether the date transferred in the first parameter is greater than or equal to the date transferred in the second parameter | ge(date1, date2) : boolean date1 (date/datetime) First date to be compared date2 (date/datetime) Second date to be compared Result: True or false // data1 is LocalDate object with value "2016-12-24" // data2 is LocalDate object with value "2016-12-24" // returns true ge(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:22" // returns true ge(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:23" // returns false ge(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:21" // returns true ge(data1, data2) |
gt | Checks whether the date given in the first parameter is greater than the date given in the second parameter | gt(date1, date2) : boolean date1 (date/datetime) First date to be compared date2 (date/datetime) Second date to be compared Result: True or false // data1 is LocalDate object with value "2016-12-24" // data2 is LocalDate object with value "2016-12-24" // returns false gt(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:22" // returns false gt(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:23" // returns false gt(data1, data2) // data1 is LocalDateTime object with value "2016-12-24T12:35:22" // data2 is LocalDateTime object with value "2016-12-24T12:35:21" // returns true gt(data1, data2) |
Table actions
Functions that perform basic activities on the tables
Name | Description | Function variants |
| Returns the element of the array with the given index. | item(index, array) : object index (integer) Item index array (object[]) Array of any type Result: Element from the given index //returns "b" item(1, ["a", "b"]); |
| Returns the length of the array. In case of checking if table has 0 length, we should use emptyArray function, because length returns wrong value for arrays of 0 length. | length(array) : integer array (object[]) Array of any type Result: Table lenght //returns 2 length(["a", "b"]); |
| Formats the number by the given separators and the number of decimal places for each value in the table. | format(value[], decimalLen, decimalSeparator, thousandSeparator) : string[] value (float[]/integer[]) An array of numeric values to format decimalLen (integer) Number of decimal places decimalSeparator (string) Fractional separator thousandSeparator (string) Thousand separator (in the case of an empty string, the separator will not appear) Result: The formatted numerical value in the form of a text table // returns ["9 999,1230","1 234,0000", "4 234,1234"] format([9999.123 , 1234 , 4321.12345], 4, ",", " ") // returns ["9,999.1230"] format( [9999.123], 4, ".", "," ) // returns ["10000"] format([10000.123], 0, ",", "") // returns ["149,13"] format([149.125], 2, ",", " ") |
| Formats a string of characters by the given schema for each value in the array. |
formatText(schema[], parameters, [customRegex]) : string[] schema (string[]) An array of schemas, in which consecutive characters # (or given as an optional parameter customRegex) will be replaced by consecutive characters from parameters. parameters (string[]) Text parameters whose subsequent characters will be entered into the schema. customRegex (string) Parameter that changes the "#" character in the schema by default, to any other Result: An array of strings formatted according to the schema // returns ["AAA-BBB-123","ACAFA123"] formatText(["###-BBB-###","#C#F####"], ["AA", "A123"]) // returns ["#1234BB","12034##BB"] formatText("#ZZZZZZ",ZZ0ZZ##ZZ ["1234BB"], "Z") |
| (since CUF-Components 1.0.30 ) A common part of two tables. Returns elements that are in both the first and the second table, without repetition. | intersect(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) First value array arr2 (string[] | integer[] | float[] | date[]) Second value array Result: Value array (common part of tables) of the type depending on the selected parameters. // returns ["aaa"] intersect(["aaa", "ccc"], ["aaa", "bbb"]) // returns [5] intersect([null, 4, 5], [5, 1]) // returns [] intersect([true], [false, null]) |
| (since CUF-Components 1.0.30 ) The difference between two tables. Returns items that are in the first, but not in the second array, without repetition. | except(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) First value array arr2 (string[] | integer[] | float[] | date[]) Second value array Result: Table of values (difference of tables) with a type depending on the selected parameters. // returns ["ccc"] except(["aaa", "ccc"], ["aaa", "bbb"]) // returns [null, 4] except([null, 4, 5], [5, 1]) // returns [true] except([true], [false, null]) |
| (since CUF-Components 1.0.30 ) The sum of two tables. Returns elements that are in the first or second array, without repetition. | union(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) First value array arr2 (string[] | integer[] | float[] | date[]) Second value array Result: Array of values (sum of tables) with a type depending on the selected parameters.
// returns ["aaa", "ccc", "bbb"] union(["aaa", "ccc"], ["aaa", "bbb"]) // returns [null, 4, 5, 1] union([null, 4, 5], [5, 1]) // returns [true, false, null] union([true], [false, null]) |
| (since CUF-Components 1.0.30 ) The symmetric difference of two tables. Returns elements that are not simultaneously in the first and second table, without repetition. | symmetricDifference(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) First value array arr2 (string[] | integer[] | float[] | date[]) Second value array Result: Table of values (symmetrical difference of tables) with a type depending on the selected parameters.
// returns ["ccc", "bbb"] symmetricDifference(["aaa", "ccc"], ["aaa", "bbb"]) // returns [null, 4, 1] symmetricDifference([null, 4, 5], [5, 1]) // returns [true, false, null] symmetricDifference([true], [false, null]) |
| (since CUF-Components 1.0.30 ) The sum of two tables. Creates a new table by merging two arrays passed in the parameter. | unionAll(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) First value array arr2 (string[] | integer[] | float[] | date[]) Second value array Result: Table of values (sum of tables) with a type depending on the selected parameters.
// returns ["aaa","ccc", "aaa", "bbb"] unionAll(["aaa", "ccc"], ["aaa", "bbb"]) // returns [null, 4, 5, 5, 1] unionAll([null, 4, 5], [5, 1]) // returns [true, false, null] unionAll([true], [false, null]) |
| (since CUF-Components 1.0.30 ) A function that returns an array of values without repetition from the table passed in the parameter. | distinct(array) : object[] array (string[] | integer[] | float[] | date[]) Value array Result: An array with values of a type depending on the type passed in the parameter
// returns ["aaa", "bbb"] distinct(["aaa", "bbb", "aaa"]) // returns [null, 4, 5] distinct([null, 4, 5, null, 4) // returns [true, false] distinct([true, true, true, false, false]) |
Type conversion
Features that allow conversion of types
Name | Description | Function variants |
| Converts the given value to its default text form. It is possible to convert from:
| toString(value) : string |
value (boolean|integer|float|date|datetime) Converted value Result: Text representing the value //returns "false" toString(false); | ||
| Converts a given table of values to an array of text values. The conversion rules are the same as for the toString function. | toStringArray(array) : string[] |
array (boolean[]|integer[]|float[]|date[]|datetime[]) Converted value array Result: Text array //returns ["false", "true"] toStringArray([false, true]); | ||
| Converts the given value to a boolean value. It is possible to convert from:
| toBoolean(value) : boolean |
value (string|integer|float) Value to be converted Result: Logical value //returns true toBoolean("true"); | ||
| Converts a given table of values into a Boolean array. The conversion rules are the same as for the toBoolean function. | toBooleanArray(array) : boolean[] |
array (string[]|integer[]|float[]) Converted value array Result: Array of logical values //returns [false, true] toBooleanArray([0, 1]); | ||
| Converts the given value to an integer. It is possible to convert from:
| toInteger(value) : integer |
value (boolean|string|float) Converted value Result: Integer //returns 123 toInteger("123"); | ||
| Converts a given table of values to an array of integers. The conversion rules are the same as in toInteger function. | toIntegerArray(array) : integer[] |
array (boolean[]|string[]|float[]) Converted value array Result: Array of integers //returns [1, 2] toIntegerArray(["1", "2"]); | ||
| Converts the given value to a floating-point number. It is possible to convert from:
| toFloat(value) : float |
value (boolean|string|integer) Converted value Result: Floating point number //returns 123.123 toFloat("123.123"); | ||
| Converts a given table of values to a floating-point number table. The conversion rules are the same as for the toFloat function. | toFloatArray(array) : float[] |
array (boolean[]|string[]|integer[]) Converted value array Result: Array of floating-point numbers //returns [1.0, 2.3] toFloatArray(["1", "2.3"]); |
Contextual
Functions that use contexts to read data related to the currently performed action. Example is a function that returns the login of the currently logged in user.
Name | Description | Function variants |
| Returns information about the current user. The parameterless option returns the login, whereas the variant with the parameter returns the given one of the following attributes:
| currentUser() : string |
Result: Current user’s login. // e.g. "admin" currentUser() | ||
currentUser(property) : string | ||
property (string) Name of the user’s attribute being returned. Result: Value of the given attribute of the current user // e.g. "admin@suncode.pl" currentUser("email") | ||
| Returns the list of group names of the current user.
| currentUserGroups() : string[] |
Result: An array of group names to which the user belongs // e.g. ["employee", "admin"] currentUserGroups() | ||
| Checks whether the current user belongs to the group with the given name. | currentUserInGroup(group) : boolean |
group (string) Group name Result: true if the user belongs to the given group // true if belongs to group currentUserGroups("employee") | ||
| Returns the symbols of all current user positions. | currentUserPositions() : string[] |
Result: Array of user positions // e.g. ["p01", "d02"] currentUserPositions() | ||
| Returns the names of all positions of the current user. | currentUserPositionNames() : string[] |
Result: Array of user positions // e.g. ["Employee", "Approver"] currentUserPositionNames() | ||
| Checks whether the current user has a position with the given symbol. | currentUserHasPosition(symbol) : boolean |
symbol (string) Position symbol Result: true if user is assigned to the given position // true if user assigned to position currentUserHasPostition("p01") | ||
| Returns the symbols of all organizational units of the current user. | currentUserUnits() : string[] |
Result: Array of symbols of the organizational units to which the user belongs // e.g. ["HR", "it"] currentUserUnits() | ||
| Returns the names of all organizational units of the current user. | currentUserUnitNames() : string[] |
Result: Array of names of the organizational units to which the user belongs // e.g. ["HR department", "IT department"] currentUserUnitNames() | ||
| Checks whether the current user belongs to the organizational unit with the given symbol. | currentUserInUnit(symbol) : boolean |
symbol (string) Organizational unit symbol Result: true if the user belongs to the given organizational unit // true if the user belongs to the unit currentUserInUnit("it") | ||
| Returns the symbols of all parent positions of the current user. | currentUserHigherPostitions() : string[] |
Result: Array of symbols of the user’s parent positions // e.g. ["kp"] currentUserHigherPositions() | ||
| Returns the names of all parent positions of the current user. | currentUserHigherPostitionNames() : string[] |
Result: Array of names of the user’s parent positions // e.g. ["Production manager"] currentUserHigherPositionNames() | ||
| Returns the logins of all direct supervisors (from parent positions) of the current user. | currentUserSupervisors() : string[] |
Result: Array of logins of all direct supervisors of the current user // e.g. ["akowalski"] currentUserSupervisors() | ||
| Checks whether the person with the given login is the current user's supervisor. | currentUserSupervisors(username) : boolean |
username (string) User login Result: true if the given user is the direct supervisor of the current user // true if "akowalski" is // supervisor of user currentUserHasSupervisor("akowalski") |
Conditional
Functions returning a given parameter after fulfilling a given condition
Name | Description | Function variants |
| Conditional function (if) - returns the given parameter depending on the condition parameters Object1 and Object2 must be the same type available types:
| ifFn( Boolean , Object1 , Object2 ) : Object
Boolean – condition of the function Object1 – returns when the condition is true Object2 - returns when the condition is false
Result:
The result is the Object1 or Object2 parameter depending on the fulfilled condition // returns 2 ifFn(true,2,3); // returns "NO" ifFn(false,"YES", "NO"); // returns ["a","b"] ifFn(false,["AA","BB","CC"], ["a","b"]); |
Translation
Functions for retrieving translations.
Name | Description | Function variants |
| Returns the translation for the specified key. If the translation is not found, the given key is returned. Servers (scope = SERVER), client translators and translations from plugins are taken into account. | translate(text) : string |
text (string) String to be translated. Result: Translated string found from all available translators. // e.g. "Yes", if user has // Polish language set translate("yes") | ||
translate(text, translatorName) : string | ||
text (string) String to be translated. translatorName (string) Name of the translator Result: Translated string found in the given translator. // e.g. "Faktury", if a client translator was created // or the translation has been added to the plugin // with this id translate("invoices", "customTranslatorName") | ||
translate(text, args, translatorName) : string | ||
text (string) String to be translated. args (string[]) Parameters passed to the translator. Substituted for tags {0}, {1} etc. translatorName (string) Name of the translator Result: Translated string found in the given translator with the substituted parameters // e.g. for translator name "customTranslatorName" and key // invoice=Faktura no {0} from {1}translate("invoice", ["123", "1000"], "customTranslatorName")// result "Faktura no 123 from 1000” It is preferred to use the function with the given name of the translator, because it clearly indicates the translation from among all translators loaded in the system. |
User
Name | Description | Function variants |
| A server function that returns users from a given group and (optionally) an organizational unit | usersFromGroup(groupName) : string[] |
groupName (string) Group name Result: Array of user logins | ||
usersFromGroup(groupName, ou) : string[] | ||
groupName (string) Group name ou (string) Organizational unit symbol Result: Array of user logins | ||
| A server function that returns users from a given role and (optionally) an organizational unit | usersWithRole(roleId) |
roleId (string) Role | ||
usersWithRole(roleId, ou) | ||
roleId (string) Role ou (string) Organizational unit symbol | ||
| A server function that returns supervisors to the user. The array of values is returned, not the text. | userSuperiors(userName) : string[] userName (string) User name |
| (since CUF-Components 1.0.29 ) A server function that downloads user logins from an organizational unit with the given name | usersFromOU(ou) ou (string) Organizational unit name Result: Table with user logins |
| (since CUF-Components 1.0.29) A server function that retrieves user logins from an organizational unit with the given symbol | usersFromOUSymbol(ousymbol) ouSymbol Organizational unit symbol Result: Table with user logins |
| (since CUF-Components 1.0.29) A server function that retrieves user logins with a position with the given name | usersWithPosition(position) postition Position name Result: Table with user logins |
| (since CUF-Components 1.0.29) A server function that retrieves user logins with a position with the given symbol | usersWithPositionSymbol(positionSymbol) postitionSymbol Position symbol Result: Table with user logins |
Strona zawiera spis wszystkich wbudowanych funkcji. Funkcje te można wykorzystywać m.in. do:
- wstępnego przetwarzania parametrów (np. akcji formularza)
- tworzenia warunków wywołania (np. walidatory)
W parametrach każdej z funkcji możemy użyć stałej, zmiennej ( $id_zmiennej ) lub innej funkcji ( #nazwa_funkcji() ) np:
#round( #sum( [$var1, $var2] ), 2)
Ogólnego przeznaczenia
Funkcje ogólne działające na danych różnego typu.
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Sprawdza czy podane wartości są sobie równe. | eq(v1, v2) : boolean v1 Dowolna pierwsza wartość v2 Dowolna druga wartość Wynik: True jeżeli podane wartości są sobie równe // równe eq( 1, 1.00 ) eq( "tekst", "tekst" ) // nie równe eq( 1, 1.01 ) eq( "tekst", "Tekst" ) |
ieq | Sprawdza równość podanych parametrów. Ignoruje wielkość liter w przypadku tekstu. | ieq(v1, v2) : boolean v1 (string) Porównywany tekst v2 (string) Porównywany tekst Wynik: True jeżeli podane teksty są sobie równe bez uwzględnienia wielkości liter równe ieq( "tekst", "tekst" ) // nie równe ieq( "tekst", "Tekst" ) |
empty | Sprawdza, czy podana wartość jest pusta, bądź posiada jeden pusty element. | empty(value) : boolean value Sprawdzana wartość dowolnego typu Wynik: True jeżeli wartość jest pusta lub posiada jeden pusty element // puste empty( "" ) empty( [] ) empty( $var1 ) empty( [""] ) empty( [null] ) // nie puste empty( "tekst" ) empty( [1, 2] ) |
anyEq | Sprawdza. czy jakakolwiek wartość z listy jest równa podanej wartości | anyEq(v1[], v2) : boolean v1[] Dowolna tablica wartości v2 Wartość tego samego typu co wartości z tabeli v1 Wynik: True jeżeli którakolwiek z wartości w v1 jest równa v2 Przykład // prawda anyEq([1,2],1) anyEq([3,2,1],1) anyEq([1],1) // fałsz anyEq([3,2,1],5) |
Tekstowe
Funkcje do pracy z tekstem.
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Łączy podane fragmenty tekstu. | concat(strings) : string strings (string[]) Tablica zawierająca fragmenty tekstu Wynik: Tekst powstały z połączenia podanych fragmentów // zwróci "tekst" concat(["te", "kst"]) |
| Łączy podane fragmenty tekstu używając podanego separatora. Aktualizacja od wersji 3.2.48 - dodano obsługę nowych typów parametrów (liczby, wartości logiczne, daty, daty z czasem) | join(fragments, [separator] ) : string fragments (object[]) Tablica zawierająca fragmenty tekstu/liczby/wartości logiczne/daty/daty z czasem separator (string) Znak którym zostaną połączone wszystkie fragmenty. Domyślnie " " (spacja). Wynik: Tekst powstały z połączenia podanych fragmentów separatorem // zwróci "Jan Kowalski" join(["Jan", "Kowalski"]) // zwróci "1;2;3" join([1, 2, 3], ";") // zwroci ";" join(["", ""], ";"); // zwróci "2;;3" join([2,null,3], ";"); |
| Zamienia pierwszą znak podanego tekstu na wielką literę. | capitalize(text) : string text (string) Tekst wejściowy Wynik: Tekst z pierwszą dużą literą // zwróci "Tekst"
capitalize("tekst")
|
| Zamienia wszystkie znaki w podanym tekście na małe litery. | lowerCase(text) : string text (string) Tekst wejściowy Wynik: Tekst zapisany tylko małymi literami // zwróci "tekst"
lowerCase("TEKST")
|
| Zamienia wszystkie znaki w podanym tekście na duże litery. | upperCase(text) : string text (string) Tekst wejściowy Wynik: Tekst zapisany tylko dużymi literami // zwróci "Tekst"
lowerCase("tekst")
|
substring | Zwraca tekst powstały z wydzielenia części podanego tekstu zgodnie z parametrami. | substring(text, start, [length]) : string text (string) Tekst wejściowy start (integer) Index startowy length (integer) [opcjonalny] Długość wydzielonego podtekstu (domyślnie do końca tekstu wejściowego). Wynik: Tekst stanowiący część tekstu wejściowego. // zwróci "ekst"
substring("tekst", 1)
// zwróci "ek"
substring("tekst", 1, 2)
|
matchesRegexp | Sprawdza, czy podany tekst jest zgodny z podanym wyrażeniem regularnym. | matchesRegex(text, regexp) : boolean text (string) Sprawdzany tekst regexp (string) Wyrażenie regularne które musi spełniać tekst. Wynik: True jeżeli podany tekst pasuje do podanego wyrażenia regularnego. // spełnia
matchesRegexp("tekst", "t.*")
// nie spełnia
matchesRegexp("tekst", "t")
|
| Zamienia wszystkie wystąpienia podanego tekstu w tekście wejściowym. | replace(text, pattern, replacement) : string text (string) Tekst wejściowy pattern(string) Wzorzec replacement (string) Zamiennik Wynik: Tekst z zamienionymi wszystkimi wystąpieniami wzorca w tekście wejściowym. // zwraca "Dzisiaj jest 2016-01-01"
replace("Dzisiaj jest _data_",
"_data_", #currentDate())
|
| Zamienia wszystkie wystąpienia tekstu spełniającego podane wyrażenie regularne w tekście wejściowym. | replaceRegexp(text, regex, replacement) : string text (string) Tekst wejściowy regex(string) Wyrażenie regularne replacement (string) Zamiennik Wynik: Tekst z zamienionymi wszystkimi spełniającymi przekazane wyrażenie regularne wystąpieniami w tekście wejściowym. // zwraca "XbcXe"
replaceRegexp("abcde", "[ad]", "X")
|
| Usuwa wszystkie białe znaki z początku i końca podanego tekstu. | trim(text) : string text (string) Tekst wejściowy Wynik: Tekst wejściowy z usuniętymi białymi znakami z początku i końca // zwraca "przykładowy tekst"
trim(" przykładowy tekst ")
|
emptyString | Zwraca pusty łańcuch znaków | emptyString() : string Wynik: Tekst w postaci: "" // zwraca pusty łańcuch znaków emptyString() |
format | Formatuje liczbę wg. podanych separatorów i liczby miejsc po przecinku. | format(value, decimalLen, decimalSeparator, thousandSeparator) : string value (float/integer) Wartość liczbowa do sformatowania decimalLen (integer) Liczba miejsc po przecinku decimalSeparator (string) Separator ułamkowy thousandSeparator (string) Separator tysięczny (w przypadku pustego łańcucha znaków separator nie pojawi się) Wynik: Sformatowana wartość liczbowa w postaci tekstowej // zwraca "9 999,1230" format(9999.123, 4, ",", " ") // zwraca "9,999.1230" format( 9999.123, 4, ".", "," ) // zwraca "10000" format(10000.123, 0, ",", "") // zwraca "149,13" format(149.125, 2, ",", " ") |
formatText | Formatuje ciąg znaków wg. podanego schematu | formatText(schema, parameters, [customRegex]) : string schema (string) Schemat, w którym kolejne znaki #(lub podane jako opcjonalny parametr customRegex) zostaną zastąpione przez kolejne znaki z parameters. parameters (string[]) Parametry tekstowe, których kolejne znaki zostaną wpisane do schematu customRegex (string) Parametr, który zmienia domyślnie podmieniany znak "#" w schemacie, na inny, dowolny Wynik: Łańcuch znaków sformatowany według schematu // zwraca AAA-BBB-123
formatText("###-BBB-###", ["AA", "A123"])
// zwraca #1234BB
formatText("#ZZZZZZ", ["1234BB"], "Z")
|
substringLast | Zwraca n ostatnich znaków ciągu znaków | substringLast(s, nChars) : string s(string) Oryginalna wartość tekstowa. nChars(integer) Ilość znaków. Wynik: Ciąg znaków o zdefiniowanej długości lub krótszy, jeżeli oryginalny ciąg jest krótszy niż pożądana liczba zwróconych znaków (wtedy funkcja zwraca oryginalny ciąg). // zwraca cd
substringLast("abcd", 2)
// zwraca ab
substringLast("ab", 3)
|
length
| Zwraca długość podanego tekstu | length(text) : integer text(string) Tekst Wynik: Długość tekstu Przykład // zwraca 0
length(null)
length("")
// zwraca 11
length("text - text")
|
indexOf | Zwraca nr wystąpienia ciągu znaku w podanym tekście. Szuka od początku do końca podanego tekstu. Gdy nie znajdzie zwraca -1; Pierwsza pozycja w tekście ma index 0 | indexOf(text,searchText) : integer indexOf(text,searchText,start) : integer text(string) Tekst do przeszukania searchText(string) Szukany ciąg znaków start(integer) Pozycja początkowa - pozycja w tekście od której ma zacząc przeszukiwać Wynik: Długość tekstu
Przykład // zwraca 7
indexOf("Ala ma kota, kot ma ale, i wszytko kończy się happy endem.","ko")
// zwraca 13
indexOf("Ala ma kota, kot ma ale, i wszytko kończy się happy endem.","ko",10)
|
lastIndexOf | Zwraca nr wystąpienia ciągu znaku w podanym tekście. Szuka od końca do początku podanego tekstu. Gdy nie znajdzie zwraca -1; Pierwsza pozycja w tekście ma index 0 | lastIndexOf(text,searchText) : integer lastIndexOf(text,searchText,start) : integer text(string) Tekst do przeszukania searchText(string) Szukany ciąg znaków start(integer) Pozycja początkowa - pozycja w tekście od której ma zacząc przeszukiwać Wynik: Długość tekstu
Przykład // zwraca 35
lastIndexOf("Ala ma kota, kot ma ale, i wszytko kończy się happy endem.","ko")
// zwraca 7
lastIndexOf("Ala ma kota, kot ma ale, i wszytko kończy się happy endem.","ko",10)
|
split | Rozdziela tekst na tablice za pomocą podanego wzorca (tekst lub wyrażenie regularne)
| split(text,regexp):string[] text(string) Tekst wejściowy regex(string) Wzorzec (wyrażenie regularne lub tekst)
Przykład // zwraca ["Ala ma kota" , "kot ma ale"]
split("Ala ma kota, kot ma ale",",")
// zwraca ["Ala" , "kota, kot" , "ale"]
split("Ala ma kota, kot ma ale","ma")
// zwraca ["Ala", "Ewa", "Marta"]
split("Ala12423423Ewa1234Marta","\d+")
|
newLine | Wstawia znak nowego wiersza | newLine() : string Wynik: Tekst w postaci: "\r\n"
// zwraca znak nowego wiersza newLine() |
Matematyczne
Funkcje do wykonywania działań matematycznych.
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Oblicza wartość bezwzględną z podanej liczby. | abs(value) : integer|float |
value (|integer|float) Dowolna liczba Wynik: Wartość bezwzględna z podanej liczby //zwraca 1.23 sum( -1.23 ) | ||
calc | Oblicza wynik działania matematycznego. | calc(num1, operator, num2) : integer|float |
num1 (integer|float) Dowolna liczba operator (string) Operator:
num2 (integer|float) Dowolna liczba Wynik: Wynik działania zgodny z podanym operatorem // dodawanie expr( 2, '+', 2 ) // odejmowanie expr( 2, '-', 2 ) // mnożenie expr( 2, '*', 2 ) // dzielenie expr( 2, '/', 2 ) | ||
le | Sprawdza czy liczba jest mniejsza lub równa podanej liczbie. | le(num1, num2) : boolean |
num1 (integer|float) Dowolna liczba num2 (integer|float) Dowolna liczba Wynik: True jeżeli liczba num1 jest mniejsza od lub równa liczbie num2. // 'false' le(11, 10) // 'true' le(10, 10) // 'true' le(9, 10) | ||
lt | Sprawdza czy liczba jest mniejsza od podanej liczby. | lt(num1, num2) : boolean |
num1 (integer|float) Dowolna liczba num2 (integer|float) Dowolna liczba Wynik: True jeżeli liczba num1 jest mniejsza od liczby num2. // 'false' lt(11, 10) // 'false' lt(10, 10) // 'true' lt(9, 10) | ||
ge | Sprawdza czy liczba jest większa lub równa podanej liczbie. | ge(num1, num2) : boolean |
num1 (integer|float) Dowolna liczba num2 (integer|float) Dowolna liczba Wynik: True jeżeli liczba num1 jest większa od lub równa liczbie num2. // 'true' ge(11, 10) // 'true' ge(10, 10) // 'false' ge(9, 10) | ||
gt | Sprawdza czy liczba jest większa od podanej liczby. | gt(num1, num2) : boolean |
num1 (integer|float) Dowolna liczba num2 (integer|float) Dowolna liczba Wynik: True jeżeli liczba num1 jest większa od liczby num2. // 'true' gt(11, 10) // 'false' gt(10, 10) // 'false' gt(9, 10) | ||
| Zaokrąglanie w górę. Zwraca najmniejszą liczbę całkowitą większą od lub równą podanej liczbie. | ceil(value) : integer |
value (float) Zaokrąglana liczba Wynik: Najmniejsza liczba całkowita większa lub równa podanej liczbie. //zwraca 3 ceil( 3 ) ceil( 2.11 ) | ||
| Zaokrąglanie w dół. Zwraca największą liczbę całkowitą mniejszą od lub równą podanej liczbie. | floor(value) : integer |
value (float) Zaokrąglana liczba Wynik: Najmniejsza liczba całkowita mniejsza od lub równa podanej liczbie. //zwraca 2 ceil( 2 ) ceil( 2.65 ) | ||
| Zaokrągla liczbę do podanej liczby miejsc po przecinku. | round(value, [places]) : float |
value (float) Zaokrąglana liczba places (integer) [opcjonalny] Liczba miejsc po przecinku do których zaokrąglamy. Domyślnie zaokrąglanie do części całkowitej (0) . Wynik: Liczba zaokrąglona do podanej liczby miejsc po przecinku //zwraca 12 round( 12.236 ) //zwraca 12.24 round( 12.236, 2 ) | ||
| Zwraca najmniejszą z podanych liczb. | min(numbers) : integer|float |
numbers (integer[]|float[]) Tablica liczb Wynik: Zwraca najmniejszą z podanych liczb. //zwraca 1 min( [1, 10, 5] ) | ||
| Zwraca największą z podanych liczb. | max(numbers) : integer|float |
numbers (integer[]|float[]) Tablica liczb Wynik: Zwraca największą z podanych liczb. //zwraca 10 min( [1, 10, 5] ) | ||
| Zwraca sumę z wszystkich podanych liczb.
| sum(numbers) : float |
numbers (integer[]|float[]) Tablica liczb Wynik: Zwraca sumę wszystkich podanych liczb. //zwraca 6 sum( [1, 10, -5] ) | ||
anyLe | Sprawdza czy jakakolwiek liczba z tablicy jest mniejsza lub równa podanej liczbie. | anyLe(num1[], num2) : boolean |
num1[] (integer|float) Dowolna tabela liczb num2 (integer|float) Liczba tego samego typu co liczby w tabeli num1 Wynik: True jeżeli jakakolwiek liczba z num1 jest mniejsza lub równa liczbie num2. // zwraca true anyLe([1,2,3],1) anyLe([0,2,3],1) // zwraca false anyLe([2,2,3],1) | ||
anyLt | Sprawdza czy jakakolwiek liczba z tablicy jest mniejsza od podanej liczby. | anyLt(num1[], num2) : boolean |
num1[] (integer|float) Dowolna tabela liczb num2 (integer|float) Liczba tego samego typu co liczby w tabeli num1 Wynik: True jeżeli jakakolwiek liczba z num1 jest mniejsza od num2. // zwraca true anyLt([0,2,3],1) // zwraca false anyLt([1,2,3],1) anyLt([2,2,3],1) | ||
anyGe | Sprawdza czy jakakolwiek liczba z tablicy jest większa lub równa podanej liczbie. | anyGe(num1[], num2) : boolean |
num1[] (integer|float) Dowolna tabela liczb num2 (integer|float) Liczba tego samego typu co liczby w tabeli num1 Wynik: True jeżeli jakakolwiek liczba z num1 jest większa lub równa liczbie num2. // zwraca true anyGe([1,2,3],1) anyGe([2,2,3],1) // zwraca false anyLt([0,0,-1],1) | ||
anyGt | Sprawdza czy jakakolwiek liczba z tablicy jest większa od podanej liczby. | anyGt(num1[], num2) : boolean |
num1[] (integer|float) Dowolna tabela liczb num2 (integer|float) Liczba tego samego typu co liczby w tabeli num1 Wynik: True jeżeli jakakolwiek liczba z num1 jest większa od num2. // zwraca true anyLt([1,0,3],1) // zwraca false anyLt([1,0,1],1) anyLt([0,0,-2],1) |
Logiczne
Operatory logiczne są przydatne przede wszystkim w warunkach uruchomienia akcji, walidatora itp.
Możemy dzięki nim tworzyć skomplikowane warunki np. warunek wartość zmiennej 'var1' jest równa 'tak' lub wartość zmiennej 'var1' jest równa 'nie' i jednocześnie wartość zmiennej 'var2' jest równa 'tak':
#or( #eq( $var1, "tak" ), #and( #eq( $var1, "nie" ), #eq( $var2, "tak" ) ) )
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Zwraca negację przekazanego parametru. | not(value) : boolean |
value (boolean) Wartość logiczna Wynik: Zwraca negację przekazanej wartości. //zwraca false not( true ) | ||
| Iloczyn logiczny, zwraca true jeżeli wszystkie przekazane parametry są prawdziwe. | and(values) : boolean |
values (boolean[]) Tablica wartości logicznych Wynik: Zwraca iloczyn logiczny wszystkich przekazanych wartości //zwraca true and( true, true ) //zwraca false and( false, true ) //zwraca false and( false, false ) | ||
| Suma logiczna, zwraca true jeżeli co najmniej jeden z przekazanych parametrów jest prawdziwy. | or(values) : boolean |
values (boolean[]) Tablica wartości logicznych Wynik: Zwraca sumę logiczną wszystkich przekazanych wartości //zwraca true or( true, true ) //zwraca true or( false, true ) //zwraca false or( false, false ) |
Data i czas
Funkcje do przetwarzania daty i czasu.
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Zwraca aktualny rok. | currentYear() : integer
Wynik:
Pełny rok, np. 2017. |
| Oblicza różnicę w dniach między dwoma datami.
| calculateDaysDifference() : integer
firstDate (date)
Data pierwsza.
secondDate (date)
Data druga.
includeFreeDays (boolean)
Uwzględnienie dni wolnych. Jeśli uwzględnimy dni wolne, różnica będzie większa o liczbę dni wolnych wypadających między datami (uwzględniając te daty). Funkcja ta bięże pod uwagę systemowy parametr "CustomHolidays" . Parametr ten zawiera liste dodatkowych dni wolnych odzielonych średnikiem ( ; ). Daty mogą byc wpisane w formie pełnej (2018-05-02) lub skróconej (05-02). np: 2018-05-02;05-04
Wynik:
Ilość dni wynikająca z obustronnie domkniętego przedziału wyznaczanego przez dwie daty. Jako że przedział jest domknięty obustronnie, w przypadku podania dwóch sąsiednich dni spełniających kryterium, funkcja zwróci wartość 2. |
| Zwraca aktualną datę. | currentDate() : date Wynik: Aktualna data. //zwraca aktualną datę //np. 2016-01-01 currentDate() |
| Zwraca aktualną datę z czasem. | currentDateTime() : datetime Wynik: Aktualna data wraz z czasem. //zwraca aktualną datę z czasem //np. 2016-01-01 12:30:45 currentDateTime() |
| Formatuje podaną datę do postaci tekstowej zgodnie z podanym formatem. | formatDate(date, format) : string date (date|datetime) Formatowana data format (string) Format daty. Dostępne są formaty wbudowane:
Wynik: Aktualna data wraz z czasem. // 2015-12-31 12:33:44 //zwraca "2015-12-31" formatDate(#currentDateTime(), "date") |
| Oblicza datę na podstawie przekazanych parametrów. Umożliwia dodawanie/odejmowanie od podanej daty lat, miesięcy, dni etc. | calcDate(date, interval, unit) : date date (date) Data bazowa interval(integer) Okres czasu który zostanie dodany/odjęty od podanej daty unit (string) Jednostka czasu, jedna z:
Wynik: Obliczona data // 2015-12-31 //zwraca 2015-12-32 calcDate(#currentDate(), 1, "day"); //zwraca 2014-12-32 calcDate(#currentDate(), -1, "y"); |
| Oblicza datę i czas na podstawie przekazanych parametrów. Umożliwia dodawanie/odejmowanie od podanej daty lat, miesięcy, dni, godzin, minut etc. | calcDateTime(date, interval, unit) : datetime date (datetime) Data bazowa interval(integer) Okres czasu który zostanie dodany/odjęty od podanej daty unit (string) Jednostka czasu, jedna z:
Wynik: Obliczona data // 2015-12-31 12:33:44 //zwraca 2015-12-32 12:33:44 calcDate(#currentDateTime(), 1, "day"); //zwraca 2014-12-32 12:33:44 calcDate(#currentDateTime(), -1, "y"); |
le | Sprawdza czy data przekazana w pierwszym parametrze jest mniejsza lub równa od daty przekazanej w drugim parametrze | le(date1, date2) : boolean date1 (date/datetime) Pierwsza data do porównania date2 (date/datetime) Druga data do porównania Wynik: Prawda lub fałsz
// data1 to obiekt LocalDate o wartości "2016-12-24" // data2 to obiekt LocalDate o wartości "2016-12-24" // zwraca true le(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDate o wartości "2016-12-24T12:35:22" // zwraca true le(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDate o wartości "2016-12-24T12:35:23" // zwraca true le(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDate o wartości "2016-12-24T12:35:21" // zwraca false le(data1, data2)
|
lt | Sprawdza czy data przekazana w pierwszym parametrze jest mniejsza od daty przekazanej w drugim parametrze | lt(date1, date2) : boolean date1 (date/datetime) Pierwsza data do porównania date2 (date/datetime) Druga data do porównania Wynik: Prawda lub fałsz // data1 to obiekt LocalDate o wartości "2016-12-24" // data2 to obiekt LocalDate o wartości "2016-12-24" // zwraca false lt(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // zwraca false lt(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:23" // zwraca true lt(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:21" // zwraca false lt(data1, data2) |
ge | Sprawdza czy data przekazana w pierwszym parametrze jest większa lub równa od daty przekazanej w drugim parametrze | ge(date1, date2) : boolean date1 (date/datetime) Pierwsza data do porównania date2 (date/datetime) Druga data do porównania Wynik: Prawda lub fałsz // data1 to obiekt LocalDate o wartości "2016-12-24" // data2 to obiekt LocalDate o wartości "2016-12-24" // zwraca true ge(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // zwraca true ge(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:23" // zwraca false ge(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:21" // zwraca true ge(data1, data2) |
gt | Sprawdza czy data przekazana w pierwszym parametrze jest wieksza od daty przekazanej w drugim parametrze | gt(date1, date2) : boolean date1 (date/datetime) Pierwsza data do porównania date2 (date/datetime) Druga data do porównania Wynik: Prawda lub fałsz // data1 to obiekt LocalDate o wartości "2016-12-24" // data2 to obiekt LocalDate o wartości "2016-12-24" // zwraca false gt(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // zwraca false gt(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:23" // zwraca false gt(data1, data2) // data1 to obiekt LocalDateTime o wartości "2016-12-24T12:35:22" // data2 to obiekt LocalDateTime o wartości "2016-12-24T12:35:21" // zwraca true gt(data1, data2) |
Działania na tablicach
Funkcje realizujące podstawowe działania na tablicach
Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Zwraca element tablicy o podanym indeksie. | item(index, array) : object index (integer) Indeks elementu array (object[]) Tablica dowolnego typu Wynik: Element z podanego indeksu //zwraca "b" item(1, ["a", "b"]); |
length | Zwraca długość tablicy. | length(array) : integer array (object[]) Tablica dowolnego typu Wynik: Długość tablicy //zwraca 2 length(["a", "b"]); |
formatArray | Formatuje liczbę wg. podanych separatorów i liczby miejsc po przecinku dla każdej wartości w tablicy. | format(value[], decimalLen, decimalSeparator, thousandSeparator) : string[] value (float[]/integer[]) Tablica wartości liczbowych do sformatowania decimalLen (integer) Liczba miejsc po przecinku decimalSeparator (string) Separator ułamkowy thousandSeparator (string) Separator tysięczny (w przypadku pustego łańcucha znaków separator nie pojawi się) Wynik: Sformatowana wartość liczbowa w postaci tablicy tekstowej
// zwraca ["9 999,1230","1 234,0000", "4 234,1234"] format([9999.123 , 1234 , 4321.12345], 4, ",", " ") // zwraca ["9,999.1230"] format( [9999.123], 4, ".", "," ) // zwraca ["10000"] format([10000.123], 0, ",", "") // zwraca ["149,13"] format([149.125], 2, ",", " ") |
formatTextArray | Formatuje ciąg znaków wg. podanego schematu dla każdej wartości w tablicy. | formatText(schema[], parameters, [customRegex]) : string[] schema (string[]) Tablica schematów, w którym kolejne znaki #(lub podane jako opcjonalny parametr customRegex) zostaną zastąpione przez kolejne znaki z parameters. parameters (string[]) Parametry tekstowe, których kolejne znaki zostaną wpisane do schematu customRegex (string) Parametr, który zmienia domyślnie podmieniany znak "#" w schemacie, na inny, dowolny Wynik: Tablica łańcuchów znaków sformatowany według schematu
// zwraca ["AAA-BBB-123","ACAFA123"]
formatText(["###-BBB-###","#C#F####"], ["AA", "A123"])
// zwraca ["#1234BB","12034##BB"]
formatText("#ZZZZZZ",ZZ0ZZ##ZZ ["1234BB"], "Z")
|
intersect | ( od CUF-Components 1.0.30 ) Wspólna część dwóch tablic. Zwraca elementy, które znajdują się zarówno w pierwszej, jak i w drugiej tablicy, bez powtórzeń. | intersect(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) Pierwsza tablica wartości arr2 (string[] | integer[] | float[] | date[]) Druga tablica wartości Wynik: Tablica wartości (wspólna część tablic) o typie zależnym od wybranych parametrów.
// Zwraca ["aaa"] intersect(["aaa", "ccc"], ["aaa", "bbb"]) // Zwraca [5] intersect([null, 4, 5], [5, 1]) // Zwraca [] intersect([true], [false, null]) |
except | ( od CUF-Components 1.0.30 ) Różnica dwóch tablic. Zwraca elementy, które znajdują się w pierwszej, ale nie znajdują w drugiej tablicy, bez powtórzeń. | except(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) Pierwsza tablica wartości arr2 (string[] | integer[] | float[] | date[]) Druga tablica wartości Wynik: Tablica wartości (różnica tablic) o typie zależnym od wybranych parametrów.
// Zwraca ["ccc"] except(["aaa", "ccc"], ["aaa", "bbb"]) // Zwraca [null, 4] except([null, 4, 5], [5, 1]) // Zwraca [true] except([true], [false, null]) |
union | ( od CUF-Components 1.0.30 ) Suma dwóch tablic. Zwraca elementy, które znajdują się w pierwszej lub w drugiej tablicy, bez powtórzeń. | union(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) Pierwsza tablica wartości arr2 (string[] | integer[] | float[] | date[]) Druga tablica wartości Wynik: Tablica wartości (suma tablic) o typie zależnym od wybranych parametrów.
// Zwraca ["aaa", "ccc", "bbb"] union(["aaa", "ccc"], ["aaa", "bbb"]) // Zwraca [null, 4, 5, 1] union([null, 4, 5], [5, 1]) // Zwraca [true, false, null] union([true], [false, null]) |
symmetricDifference | ( od CUF-Components 1.0.30 ) Różnica symetryczna dwóch tablic. Zwraca elementy, które nie znajdują się jednocześnie w pierwszej i drugiej tablicy, bez powtórzeń. | symmetricDifference(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) Pierwsza tablica wartości arr2 (string[] | integer[] | float[] | date[]) Druga tablica wartości Wynik: Tablica wartości (różnica symetryczna tablic) o typie zależnym od wybranych parametrów.
// Zwraca ["ccc", "bbb"] symmetricDifference(["aaa", "ccc"], ["aaa", "bbb"]) // Zwraca [null, 4, 1] symmetricDifference([null, 4, 5], [5, 1]) // Zwraca [true, false, null] symmetricDifference([true], [false, null]) |
unionAll | ( od CUF-Components 1.0.30 ) Suma dwóch tablic. Tworzy nową tablicę scalając dwie tablice przekazane w parametrze. | unionAll(arr1, arr2) : object[] arr1 (string[] | integer[] | float[] | date[]) Pierwsza tablica wartości arr2 (string[] | integer[] | float[] | date[]) Druga tablica wartości Wynik: Tablica wartości (suma tablic) o typie zależnym od wybranych parametrów.
// Zwraca ["aaa","ccc", "aaa", "bbb"] unionAll(["aaa", "ccc"], ["aaa", "bbb"]) // Zwraca [null, 4, 5, 5, 1] unionAll([null, 4, 5], [5, 1]) // Zwraca [true, false, null] unionAll([true], [false, null]) |
distinct | ( od CUF-Components 1.0.30 ) Funkcja zwracająca tablicę wartości bez powtórzeń z tabeli przekazanej w parametrze. | distinct(array) : object[] array (string[] | integer[] | float[] | date[]) Tablica wartości Wynik: Tablica z wartościami o typie zależnym od typu przekazanego w parametrze
// Zwraca ["aaa", "bbb"] distinct(["aaa", "bbb", "aaa"]) // Zwraca [null, 4, 5] distinct([null, 4, 5, null, 4) // Zwraca [true, false] distinct([true, true, true, false, false]) |
filter | Funkcja filtrująca elementy tablicy wg podanych kryteriów. Pozostawia te wartości, które spełnią wszystkie z filtrów. Filtr może być pojedyńczy lub tablicowy. Filtry pojedyncze porównują wartości z pola Kolumny do filtrowania z wartością w polu Wartości filtrujące. Filtry tablicowe porównują wartości z pola Kolumny do filtrowania z odpowiadającymi im (pod względem kolejności) wartościami podanymi w polu Kolumny filtrujące.
| filter(array, singleVariables, singleFilterTypes, singleFilter, multiVariables, multiFilterTypes multiFilter) : string[] | integer[] | float[] | date[] array (string[] | integer[] | float[] | date[] ) Tablica wartości singleVariables( Variable[] ) singleFilterTypes( string[] ) Rodzaj filtrowania singleFilter( string[] ) Pojedynczy filtr multiVariables( Variable[] ) Kolumny do filtrowania (dla wartości tabelarycznych) multiFilterTypes( string[] ) Rodzaj filtrowania multiFilter( variable[] ) Tablicowy filtr |
Konwersja typów
Funkcje umożliwiające konwersję typów
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Konwertuje podaną wartość do jej domyślnej postaci tekstowej. Możliwa jest konwersja z:
| toString(value) : string |
value (boolean|integer|float|date|datetime) Konwertowana wartość Wynik: Tekst reprezentujący wartość //zwraca "false" toString(false); | ||
| Konwertuje podaną tablicę wartości do tablicy wartości tekstowych. Zasady konwersji są takie same jak w przypadku funkcji toString. | toStringArray(array) : string[] |
array (boolean[]|integer[]|float[]|date[]|datetime[]) Konwertowana tablica wartości Wynik: Tablica wartości tekstowych //zwraca ["false", "true"] toStringArray([false, true]); | ||
| Konwertuje podaną wartość do wartości logicznej. Możliwa jest konwersja z:
| toBoolean(value) : boolean |
value (string|integer|float) Konwertowana wartość Wynik: Wartość logiczna //zwraca true
toBoolean("true");
| ||
| Konwertuje podaną tablicę wartości do tablicy wartości logicznych. Zasady konwersji są takie same jak w przypadku funkcji toBoolean. | toBooleanArray(array) : boolean[] |
array (string[]|integer[]|float[]) Konwertowana tablica wartości Wynik: Tablica wartości logicznych //zwraca [false, true] toBooleanArray([0, 1]); | ||
| Konwertuje podaną wartość do liczby całkowitej. Możliwa jest konwersja z:
| toInteger(value) : integer |
value (boolean|string|float) Konwertowana wartość Wynik: Liczba całkowita //zwraca 123
toInteger("123");
| ||
| Konwertuje podaną tablicę wartości do tablicy liczb całkowitych. Zasady konwersji są takie same jak w przypadku funkcji toInteger. | toIntegerArray(array) : integer[] |
array (boolean[]|string[]|float[]) Konwertowana tablica wartości Wynik: Tablica liczb całkowitych //zwraca [1, 2] toIntegerArray(["1", "2"]); | ||
| Konwertuje podaną wartość do liczby zmiennoprzecinkowej. Możliwa jest konwersja z:
| toFloat(value) : float |
value (boolean|string|integer) Konwertowana wartość Wynik: Liczba zmiennoprzecinkowa //zwraca 123.123
toFloat("123.123");
| ||
| Konwertuje podaną tablicę wartości do tablicy liczb zmiennoprzecinkowych. Zasady konwersji są takie same jak w przypadku funkcji toFloat. | toFloatArray(array) : float[] |
array (boolean[]|string[]|integer[]) Konwertowana tablica wartości Wynik: Tablica liczb zmiennoprzecinkowych //zwraca [1.0, 2.3] toFloatArray(["1", "2.3"]); |
Funkcje kontekstowe
Funkcje wykorzystujące konteksty do odczytu danych związanych z aktualnie wykonywaną akcją. Przykładem jest funkcja która zwraca login aktualnie zalogowanego użytkownika.
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Zwraca informacje o aktualnym użytkowniku. Wariant bezparametrowy zwraca login, natomiast wariant z parametrem zwraca podaną właściwość jedną z:
| currentUser() : string |
Wynik: Login aktualnego użytkownika. // np. "admin" currentUser() | ||
| currentUser(property) : string | ||
property (string) Nazwa zwracanej właściwości użytkownika Wynik: Wartość podanej właściwości aktualnego użytkownika // np. "admin@suncode.pl"
currentUser("email")
| ||
| Zwraca listę nazw grup aktualnego użytkownika. | currentUserGroups() : string[] |
Wynik: Tablica nazw grup do których należy użytkownik // np. ["pracownik", "administrator"] currentUserGroups() | ||
| currentUserInGroup | Sprawdza, czy aktualny użytkownik należy do grupy o podanej nazwie. | currentUserInGroup(group) : boolean |
group (string) Nazwa grupy Wynik: true jeżeli użytkownik należy do podanej grupy // true jeżeli należy do grupy
currentUserGroups("pracownik")
| ||
| Zwraca symbole wszystkich stanowisk aktualnego użytkownika. | currentUserPositions() : string[] |
Wynik: Tablica symboli stanowisk użytkownika // np. ["p01", "d02"] currentUserPositions() | ||
| Zwraca nazwy wszystkich stanowisk aktualnego użytkownika. | currentUserPositionNames() : string[] |
Wynik: Tablica nazw stanowisk użytkownika // np. ["Pracownik1", "Akceptujący"] currentUserPositionNames() | ||
| Sprawdza, czy aktualny użytkownik posiada stanowisko o podanym symbolu. | currentUserHasPosition(symbol) : boolean |
symbol (string) Symbol stanowiska Wynik: true jeżeli użytkownik jest przypisany do podanego stanowiska // true jeżeli jest przypisany do stanowiska
currentUserHasPostition("p01")
| ||
| Zwraca symbole wszystkich jednostek organizacyjnych aktualnego użytkownika. | currentUserUnits() : string[] |
Wynik: Tablica symboli jednostek organizacyjnych do których należy użytkownik // np. ["kadry", "it"] currentUserUnits() | ||
| Zwraca nazwy wszystkich jednostek organizacyjnych aktualnego użytkownika. | currentUserUnitNames() : string[] |
Wynik: Tablica nazw jednostek organizacyjnych do których należy użytkownik // np. ["Kadry", "Dział IT"] currentUserUnitNames() | ||
| Sprawdza, czy aktualny użytkownik należy do jednostki organizacyjnej o podanym symbolu. | currentUserInUnit(symbol) : boolean |
symbol (string) Symbol jednostki organizacyjnej Wynik: true jeżeli użytkownik należy do podanej jednostki organizacyjnej // true jeżeli należy do jednostki
currentUserInUnit("it")
| ||
| Zwraca symbole wszystkich stanowisk nadrzędnych aktualnego użytkownika. | currentUserHigherPostitions() : string[] |
Wynik: Tablica symboli stanowisk nadrzędnych użytkownika // np. ["kp"] currentUserHigherPositions() | ||
| Zwraca nazwy wszystkich stanowisk nadrzędnych aktualnego użytkownika. | currentUserHigherPostitionNames() : string[] |
Wynik: Tablica nazw stanowisk nadrzędnych użytkownika // np. ["Kierownik Produkcji"] currentUserHigherPositionNames() | ||
| Zwraca loginy wszystkich bezpośrednich przełożonych (z nadrzędnych stanowisk) aktualnego użytkownika. | currentUserSupervisors() : string[] |
Wynik: Tablica loginów wszystkich bezpośrednich przełożonych aktualnego użytkownika // np. ["akowalski"] currentUserSupervisors() | ||
| Sprawdza, czy osoba o podanym loginie jest przełożonym aktualnego użytkownika. | currentUserSupervisors(username) : boolean |
username (string) Login użytkownika Wynik: true jeżeli podany użytkownik jest bezpośrednim przełożonym aktualnego użytkownika // true jeżeli "akowalski" jest
// przełożonym użytkownika
currentUserHasSupervisor("akowalski")
|
Funkcje warunkowe
Funkcje zawracające dany parametr po spełnieniu określonego warunku
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Funkcja warunkowa (if) - zwraca dany parametr w zależności od warunku parametry Object1 i Object2 muszą być tego samego typu: dostępne typy:
| ifFn( Boolean , Object1 , Object2 ) : Object Boolean - warunek funkcji Object1 - zwraca gdy warunek prawdziwy Object2 - zwraca gdy warunek nie prawdziwy
Wynik:
Wynikiem jest parametr Object1 lub Object2 w zależności od spełnionego warunku // zwraca 2 ifFn(true,2,3); // zwraca "NIE" ifFn(false,"TAK", "NIE"); // zwraca ["a","b"] ifFn(false,["AA","BB","CC"], ["a","b"]); |
Tłumaczenia
Funkcje umożliwiające pobieranie tłumaczeń.
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
| Zwraca tłumaczenie dla podanego klucza. Jeżeli tłumaczenie nie zostanie odnalezione, zwracany jest podany klucz. Pod uwagę brane są serwerowe (scope = SERVER) klienckie translatory oraz tłumaczenia z wtyczek. | translate(text) : string |
text (string) Klucz do przetłumaczenia Wynik: Przetłumaczony klucz wyszukany ze wszystkich dostępnych translatorów. // np. "Tak", jeżeli użytkownik ma
// ustawiony język polski
translate("yes")
| ||
| translate(text, translatorName) : string | ||
text (string) Klucz do przetłumaczenia translatorName (string) Nazwa translatora Wynik: Przetłumaczony klucz wyszukany w podanym translatorze. // np. "Faktury", jeżeli stworzony został kliencki
// translator lub tłumaczenie zostało dodane do wtyczki
// o takim id
translate("invoices", "customTranslatorName")
| ||
| translate(text, args, translatorName) : string | ||
text (string) Klucz do przetłumaczenia args (string[]) Parametry przekazywane do translatora. Podstawiane za znaczniki {0}, {1} itd. translatorName (string) Nazwa translatora Wynik: Przetłumaczony klucz wyszukany w podanym translatorze z podstawionymi parametrami // np. dla translatora o nazwie "customTranslatorName" i klucza
// invoice=Faktura nr {0} z {1}
translate("invoice", ["123", "1000"], "customTranslatorName")
// wynik "Faktura nr 123 z 1000
Preferowane jest użycie funkcji z podaną nazwą translatora, gdyż jednoznacznie wskazuje ona na tłumaczenie spośród wszystkich translatorów załadowanych w systemie. |
Użytkownik
| Nazwa | Opis | Warianty funkcji |
|---|---|---|
usersFromGroup ( od CUF-Components 1.0.16 ) | Funkcja serwerowa, która zwraca użytkowników z danej grupy i (opcjonalnie) jednostki organizacyjnej
| usersFromGroup(groupName) : string[] |
groupName (string) Nazwa grupy Wynik: Tablica loginów użytkowników | ||
| usersFromGroup(groupName, ou) : string[] | ||
groupName (string) Nazwa grupy ou (string) Symbol jednostki organizacyjnej Wynik: Tablica loginów użytkowników | ||
usersWithRole ( od CUF-Components 1.0.16 ) | Funkcja serwerowa, która zwraca użytkowników o danej roli i (opcjonalnie) jednostki organizacyjnej.
| usersWithRole(roleId) |
roleId (string) Rola | ||
| usersWithRole(roleId, ou) | ||
roleId (string) Rola ou (string) Jednostka organizacyjna (symbol) | ||
userSuperiors ( od CUF-Components 1.0.29 ) | Funkcja serwerowa zwracająca przełożonych użytkownika. Zwracana jest tablica wartości, a nie tekst. | userSuperiors(userName) : string[] userName (string) Nazwa użytkownika |
usersFromOU | ( od CUF-Components 1.0.29 ) Funkcja serwerowa pobierająca loginy użytkowników z jednostki organizacyjnej o podanej nazwie | usersFromOU(ou) ou (string) Nazwa jednostki organizacyjnej Wynik: Tablica z loginami użytkowników |
usersFromOUSymbol | ( od CUF-Components 1.0.29 ) Funkcja serwerowa pobierająca loginy użytkowników z jednostki organizacyjnej o podanym symbolu | usersFromOUSymbol(ousymbol) ouSymbol Symbol jednostki organizacyjnej Wynik: Tablica z loginami użytkowników |
usersWithPosition | ( od CUF-Components 1.0.29 ) Funkcja serwerowa pobierająca loginy użytkowników ze stanowiskiem o podanej nazwie | usersWithPosition(position) postition Nazwa stanowiska Wynik: Tablica z loginami użytkowników |
usersWithPositionSymbol | ( od CUF-Components 1.0.29 ) Funkcja serwerowa pobierająca login użytkownika ze stanowiskiem o podanym symbolu | usersWithPositionSymbol(positionSymbol) postitionSymbol Symbol stanowiska Wynik: Tablica z loginami użytkowników |
Page contains content of all embedded functions. Functions can be used e.g. for:
- initial processing parameters (e.g. form action)
- creating call conditions (e.g. validators)
W przypadku sprawdzania, czy długość tablicy wynosi 0 należy używać funkcji emptyArray, ponieważ length zwraca niepoprawny wynik dla tablic o długości 0.

