• No results found

ACTICO Rules - Modeler. Functions Reference. Version 6.7. ACTICO GmbH.

N/A
N/A
Protected

Academic year: 2021

Share "ACTICO Rules - Modeler. Functions Reference. Version 6.7. ACTICO GmbH."

Copied!
111
0
0

Loading.... (view fulltext now)

Full text

(1)

ACTICO Rules - Modeler

Functions Reference

Version 6.7

ACTICO GmbH

(2)

Functions Reference: Version 6.7

ACTICO Rules Functions Reference, Version 6.7

(3)

Functions Reference

Table of Contents

1. Arithmetic Functions ... 1

1.1. abs(Integer value) ... 2

1.2. abs(Float value) ... 2

1.3. avg(Float List list) ... 2

1.4. avg(Integer List list) ... 3

1.5. defaultIfNull(Integer value, Integer defaultValue) ... 3

1.6. defaultIfNull(Float value, Float defaultValue) ... 3

1.7. defaultIfNull(Boolean value, Boolean defaultValue) ... 3

1.8. exp(Float value) ... 4

1.9. falseIfNull(Boolean value) ... 4

1.10. formatNumber(Float number, String pattern) ... 4

1.11. formatNumber(Integer number, String pattern) ... 5

1.12. formatNumber(Float number) ... 6

1.13. formatNumber(Integer number) ... 6

1.14. formatNumberLocale(Float number, String locale) ... 6

1.15. isEqual(Float number1, Float number2, Float delta) ... 7

1.16. isInteger(String text) ... 7

1.17. isNumber(String text) ... 7

1.18. log(Float value) ... 8

1.19. log(Float value, Float base) ... 8

1.20. max(Float List list) ... 8

1.21. max(Integer List list) ... 9

1.22. min(Float List list) ... 9

1.23. min(Integer List list) ... 9

1.24. pow(Float base, Float exponent) ... 10

1.25. random() ... 10

1.26. randomInteger(Integer lowerBound, Integer upperBound) ... 10

1.27. round(Float value) ... 10

1.28. round(Float value, Integer precision) ... 11

1.29. sgn(Float value) ... 11

1.30. sqrt(Float value) ... 11

1.31. sum(Float List list) ... 12

1.32. sum(Integer List list) ... 12

1.33. truncate(Float value) ... 12

1.34. zeroIfNull(Integer value) ... 13

1.35. zeroIfNull(Float value) ... 13

2. Collection Functions ... 14

2.1. containsAll(Any Collection collection1, Any Collection collection2) ... 14

2.2. copy(Any Collection from) ... 15

2.3. count(Any List list) ... 15

2.4. count(Any Collection collection) ... 15

2.5. count(Any Collection collection : Boolean conditionalExpression) ... 15

2.6. exists(Any Collection collection : Boolean conditionalExpression) ... 16

2.7. filter(Any Collection collection : Boolean filterExpression) ... 16

2.8. first(Any Collection collection : Boolean conditionalExpression) ... 16

2.9. forall(Any Collection collection : Boolean conditionalExpression) ... 17

2.10. isEmpty(Any Collection collection) ... 17

2.11. last(Any Collection collection : Boolean conditionalExpression) ... 17

2.12. max(Any Collection collection : Any sortExpression) ... 18

2.13. min(Any Collection collection : Any sortExpression) ... 18

2.14. rankAsc(Any List list : Any sortExpression, Any element, Integer maxElements) ... 18

(4)

Functions Reference

2.15. rankDesc(Any List list : Any sortExpression, Any element, Integer maxElements) ... 19

2.16. select(Any Collection collection : Any expression) ... 19

2.17. slice(Any List list, Integer begin, Integer end) ... 19

2.18. slice(Any List list, Integer begin) ... 20

2.19. sortAsc(Any Collection collection : Any sortExpression) ... 20

2.20. sortDesc(Any Collection collection : Any sortExpression) ... 21

3. Map Functions ... 22

3.1. copy(Any -> Any Map from) ... 22

3.2. count(Any -> Any Map map) ... 22

3.3. isEmpty(Any -> Any Map map) ... 22

3.4. keys(Any -> Any Map map) ... 23

3.5. values(Any -> Any Map map) ... 23

4. Date and Time Functions ... 24

4.1. addDays(Date date, Integer days) ... 26

4.2. addDays(Timestamp timestamp, Integer day) ... 26

4.3. addHours(Time time, Integer hours) ... 27

4.4. addHours(Timestamp timestamp, Integer hour) ... 27

4.5. addMillis(Time time, Integer seconds) ... 27

4.6. addMinutes(Time time, Integer minutes) ... 28

4.7. addMinutes(Timestamp timestamp, Integer minute) ... 28

4.8. addMonths(Date date, Integer months) ... 28

4.9. addMonths(Timestamp timestamp, Integer month) ... 29

4.10. addSeconds(Time time, Integer seconds) ... 29

4.11. addSeconds(Timestamp timestamp, Integer seconds) ... 29

4.12. addTime(Time time1, Time time2) ... 30

4.13. addYears(Date date, Integer years) ... 30

4.14. addYears(Timestamp timestamp, Integer year) ... 30

4.15. currentDate() ... 31

4.16. currentTime() ... 31

4.17. currentTimestamp() ... 31

4.18. date(String text) ... 31

4.19. date(Integer year, Integer month, Integer day) ... 32

4.20. date(Timestamp timestamp) ... 32

4.21. day(Date date) ... 32

4.22. dayOfMonth(Date date) ... 33

4.23. dayOfMonth(Timestamp timestamp) ... 33

4.24. dayOfWeek(Date date) ... 33

4.25. dayOfWeek(Timestamp timestamp) ... 33

4.26. dayOfYear(Date date) ... 34

4.27. dayOfYear(Timestamp timestamp) ... 34

4.28. defaultIfNull(Date value, Date defaultValue) ... 34

4.29. defaultIfNull(Time value, Time defaultValue) ... 35

4.30. defaultIfNull(Timestamp value, Timestamp defaultValue) ... 35

4.31. diffDays(Date date1, Date date2) ... 35

4.32. diffHours(Time time1, Time time2) ... 36

4.33. diffHours(Timestamp timestamp1, Timestamp timestamp2) ... 36

4.34. diffMillis(Time time1, Time time2) ... 36

4.35. diffMinutes(Time time1, Time time2) ... 37

4.36. diffMinutes(Timestamp timestamp1, Timestamp timestamp2) ... 37

4.37. diffMonths(Date date1, Date date2) ... 37

4.38. diffSeconds(Time time1, Time time2) ... 38

4.39. diffSeconds(Timestamp timestamp1, Timestamp timestamp2) ... 38

4.40. diffTime(Time time1, Time time2) ... 39

(5)

Functions Reference

4.41. diffYears(Date date1, Date date2) ... 39

4.42. executionStartDate() ... 39

4.43. formatDate(Date date) ... 39

4.44. formatDate(Date date, String pattern) ... 40

4.45. formatTimestamp(Timestamp timestamp, String pattern) ... 40

4.46. hour(Time time) ... 40

4.47. hour(Timestamp timestamp) ... 41

4.48. isDate(String text) ... 41

4.49. isDate(Integer year, Integer month, Integer day) ... 41

4.50. max(Date List list) ... 42

4.51. max(Time List list) ... 42

4.52. max(Timestamp List list) ... 42

4.53. milli(Time time) ... 42

4.54. min(Date List list) ... 43

4.55. min(Time List list) ... 43

4.56. min(Timestamp List list) ... 43

4.57. minute(Time time) ... 44

4.58. minute(Timestamp timestamp) ... 44

4.59. month(Date date) ... 44

4.60. month(Timestamp timestamp) ... 44

4.61. nano(Timestamp timestamp) ... 45

4.62. second(Time time) ... 45

4.63. second(Timestamp timestamp) ... 45

4.64. subDays(Date date, Integer days) ... 46

4.65. subDays(Timestamp timestamp, Integer day) ... 46

4.66. subHours(Time time, Integer hours) ... 46

4.67. subHours(Timestamp timestamp, Integer hours) ... 47

4.68. subMillis(Time time, Integer millis) ... 47

4.69. subMinutes(Time time, Integer minutes) ... 47

4.70. subMinutes(Timestamp timestamp, Integer minute) ... 48

4.71. subMonths(Date date, Integer months) ... 48

4.72. subMonths(Timestamp timestamp, Integer month) ... 48

4.73. subSeconds(Time time, Integer seconds) ... 49

4.74. subSeconds(Timestamp timestamp, Integer second) ... 49

4.75. subTime(Time time1, Time time2) ... 49

4.76. subYears(Date date, Integer years) ... 50

4.77. subYears(Timestamp timestamp, Integer year) ... 50

4.78. time(String text) ... 50

4.79. time(Integer hour, Integer minute, Integer second) ... 51

4.80. time(Integer hour, Integer minute, Integer second, Integer millisecond) ... 51

4.81. time(Timestamp timestamp) ... 51

4.82. timestamp(String text) ... 52

4.83. timestamp(Date date, Time time) ... 52

4.84. timestamp(Integer year, Integer month, Integer day, Integer hour, Integer minute, Integer second, Integer nanosecond) ... 52

4.85. weekDay(Date date) ... 53

4.86. weekDayName(Date date) ... 53

4.87. year(Date date) ... 53

4.88. year(Timestamp timestamp) ... 54

5. General Functions ... 55

5.1. copy(Any from) ... 55

5.2. visits() ... 55

6. String Functions ... 56

6.1. characterAt(String text, Integer index) ... 57

(6)

Functions Reference

6.2. contains(String text, String substring) ... 57

6.3. containsIgnoreCase(String text, String substring) ... 57

6.4. defaultIfNull(String value, String defaultValue) ... 58

6.5. endsWith(String text, String substring) ... 58

6.6. endsWithIgnoreCase(String text, String substring) ... 58

6.7. equalsIgnoreCase(String text1, String text2) ... 59

6.8. formatString(String s, Integer len) ... 59

6.9. formatStringAlignRight(String s, Integer len) ... 60

6.10. indexOf(String text, String substring) ... 60

6.11. indexOfIgnoreCase(String text, String substring) ... 60

6.12. insert(String text, Integer index, String insertText) ... 61

6.13. isEmpty(String value) ... 61

6.14. lastIndexOf(String text, String substring) ... 62

6.15. lastIndexOfIgnoreCase(String text, String substring) ... 62

6.16. length(String text) ... 62

6.17. max(String List list) ... 63

6.18. min(String List list) ... 63

6.19. remove(String text, Integer startIndex, Integer endIndex) ... 63

6.20. remove(String text, String substring) ... 64

6.21. removeAll(String text, String substring) ... 64

6.22. removeAllIgnoreCase(String text, String substring) ... 65

6.23. removeIgnoreCase(String text, String substring) ... 65

6.24. replace(String text, Integer startIndex, Integer endIndex, String replacement) ... 65

6.25. replace(String text, String findText, String replacement) ... 66

6.26. replaceAll(String text, String findText, String replacement) ... 66

6.27. replaceAllIgnoreCase(String text, String findText, String replacement) ... 67

6.28. replaceIgnoreCase(String text, String findText, String replacement) ... 67

6.29. splitString(String text, String delimiter) ... 68

6.30. startsWith(String text, String substring) ... 68

6.31. startsWithIgnoreCase(String text, String substring) ... 68

6.32. substring(String text, Integer startIndex, Integer endIndex) ... 69

6.33. substring(String text, Integer startIndex) ... 69

6.34. toLowerCase(String text) ... 70

6.35. toUpperCase(String text) ... 70

6.36. trim(String text) ... 70

7. Conversion Functions ... 71

7.1. toBoolean(Float value) ... 71

7.2. toBoolean(Integer value) ... 72

7.3. toBoolean(String value) ... 72

7.4. toFloat(String text) ... 72

7.5. toInteger(String text) ... 73

7.6. toInteger(Boolean value) ... 73

7.7. toString(Any -> Any Map value) ... 73

7.8. toString(Any Collection value) ... 74

7.9. toString(Float value) ... 74

7.10. toString(Integer value) ... 74

7.11. toString(Time value) ... 75

7.12. toString(Timestamp value) ... 75

7.13. toString(String value) ... 75

7.14. toString(Boolean value) ... 75

7.15. toString(Date value) ... 76

7.16. toString(Any value) ... 76

7.17. toString(Any -> Any Map value, String defaultValue) ... 76

7.18. toString(Any Collection value, String defaultValue) ... 77

7.19. toString(Float value, String defaultValue) ... 77

(7)

Functions Reference

7.20. toString(Integer value, String defaultValue) ... 77

7.21. toString(Time value, String defaultValue) ... 78

7.22. toString(Timestamp value, String defaultValue) ... 78

7.23. toString(String value, String defaultValue) ... 78

7.24. toString(Boolean value, String defaultValue) ... 79

7.25. toString(Date value, String defaultValue) ... 79

7.26. toString(Any value, String defaultValue) ... 80

8. Visual Rules 3 Compatibility Functions ... 81

8.1. addToStringList(String stringList, String separator, String element) ... 82

8.2. countRecords(String records) ... 83

8.3. date(String year, String month, String day) ... 83

8.4. day(Time time) ... 83

8.5. diffDays(Time time1, Time time2) ... 83

8.6. diffDays(Timestamp timestamp1, Timestamp timestamp2) ... 84

8.7. differenceOfStringLists(String stringList1, String stringList2, String separator) ... 84

8.8. differenceOfStringListsIgnoreCase(String stringList1, String stringList2, String separator) ... 85

8.9. equal(Any Collection elements) ... 85

8.10. existsElementInFile(String fileName, String columnName, String elementName) ... 85

8.11. existsFile(String fileName) ... 86

8.12. existsInStringList(String stringList, String separator, String element) ... 86

8.13. existsInStringListIgnoreCase(String stringList, String separator, String element) ... 86

8.14. formatCurrency(Float value) ... 87

8.15. getAllRecordsFromFile(String fileName) ... 87

8.16. getColumnIndex(String header, String columnName) ... 87

8.17. getHeaderFromFile(String fileName) ... 88

8.18. getRecord(Integer recordIndex, String records) ... 88

8.19. getRecordsFromFile(String fileName, String columnName, String elementName) ... 88

8.20. getValueAsBoolean(String record, Integer columnIndex) ... 88

8.21. getValueAsDate(String record, Integer columnIndex) ... 89

8.22. getValueAsFloat(String record, Integer columnIndex) ... 89

8.23. getValueAsInt(String record, Integer columnIndex) ... 89

8.24. getValueAsString(String record, Integer columnIndex) ... 89

8.25. inFile(Float value, String file) ... 89

8.26. inFile(Integer value, String file) ... 90

8.27. inFile(Date value, String file) ... 90

8.28. inFile(String value, String file) ... 90

8.29. indexInStringList(String stringList, String separator, String element, Integer index) ... 91

8.30. indexInStringList(String stringList, String separator, String element) ... 91

8.31. indexInStringListIgnoreCase(String stringList, String separator, String element, Integer index) ... 92

8.32. indexInStringListIgnoreCase(String stringList, String separator, String element) ... 92

8.33. indicesOf(Any object, Any List list) ... 93

8.34. insertInStringList(String stringList, String separator, String element, Integer index) ... 93

8.35. intersectionOfStringLists(String stringList1, String stringList2, String separator) ... 94

8.36. intersectionOfStringListsIgnoreCase(String stringList1, String stringList2, String separator) ... 94

8.37. isNumberLocale(String text) ... 95

8.38. isWholeNumber(String text) ... 95

8.39. lengthOfStringList(String stringList, String separator) ... 95

8.40. next(String datasourceId) ... 96

8.41. positionOfStringListElement(String stringList, String separator, Integer index) ... 96

8.42. randomFloat() ... 97

8.43. removeFromStringList(String stringList, String separator, Integer index) ... 97

8.44. replaceInStringList(String stringList, String separator, String element, Integer index) ... 97

8.45. size(Any Collection collection) ... 98

8.46. sortStringListAscending(String stringList, String separator) ... 98

(8)

Functions Reference

8.47. sortStringListDescending(String stringList, String separator) ... 98

8.48. stringListElement(String stringList, String separator, Integer index) ... 99

8.49. subtractStringLists(String stringList1, String stringList2, String separator) ... 99

8.50. subtractStringListsIgnoreCase(String stringList1, String stringList2, String separator) ... 100

8.51. toFloatLocale(String text) ... 100

8.52. toNumber(String text) ... 100

8.53. toStringLocale(Float value) ... 101

8.54. toWholeNumber(String text) ... 101

8.55. toWholeNumber(Boolean value) ... 101

8.56. unionOfStringLists(String stringList1, String stringList2, String separator) ... 102

8.57. unionOfStringListsIgnoreCase(String stringList1, String stringList2, String separator) ... 102

(9)

Chapter 1. Arithmetic Functions

Chapter 1. Arithmetic Functions

abs (Integer value) : Integer

abs (Float value) : Float

avg (Float List list) : Float

avg (Integer List list) : Float

defaultIfNull (Integer value, Integer defaultValue) : Integer

defaultIfNull (Float value, Float defaultValue) : Float

defaultIfNull (Boolean value, Boolean defaultValue) : Boolean

exp (Float value) : Float

falseIfNull (Boolean value) : Boolean

formatNumber (Float number, String pattern) : String

formatNumber (Integer number, String pattern) : String

formatNumber (Float number) : String

formatNumber (Integer number) : String

formatNumberLocale (Float number, String locale) : String

isEqual (Float number1, Float number2, Float delta) : Boolean

isInteger (String text) : Boolean

isNumber (String text) : Boolean

log (Float value) : Float

log (Float value, Float base) : Float

max (Float List list) : Float

max (Integer List list) : Integer

min (Float List list) : Float

min (Integer List list) : Integer

pow (Float base, Float exponent) : Float

random () : Float

randomInteger (Integer lowerBound, Integer upperBound) : Integer

round (Float value) : Integer

round (Float value, Integer precision) : Float

sgn (Float value) : Integer

sqrt (Float value) : Float

sum (Float List list) : Float

sum (Integer List list) : Integer

truncate (Float value) : Integer

(10)

Chapter 1. Arithmetic Functions

zeroIfNull (Integer value) : Integer

zeroIfNull (Float value) : Float

1.1. abs(Integer value)

Returns the absolute value of a number.

Syntax. abs (Integer value) : Integer Parameters.

Name Type Description

value Integer Number whose absolute value is determined

Examples.

abs(-2) = 2 abs(2) = 2

1.2. abs(Float value)

Returns the absolute value of a number.

Syntax. abs (Float value) : Float Parameters.

Name Type Description

value Float Number whose absolute value is determined

Examples.

abs(-1.6) = 1.6 abs(1.6) = 1.6

1.3. avg(Float List list)

Returns the average of the values of a collection Syntax. avg (Float List list) : Float Parameters.

Name Type Description

list Float List List to check

Examples.

avg({2, 8, 2}) = 4.0

avg({8, 8, 7}) = 7.666666666666667 avg({2.2, 1.0, 3.1}) = 2.1

(11)

Chapter 1. Arithmetic Functions

1.4. avg(Integer List list)

Returns the average of the values of a collection Syntax. avg (Integer List list) : Float Parameters.

Name Type Description

list Integer List List to check

Examples.

avg({2, 8, 2}) = 4.0

avg({8, 8, 7}) = 7.666666666666667

1.5. defaultIfNull(Integer value, Integer defaultValue)

Returns a default value if the provided value is null. Otherwise the given value is returned.

Syntax. defaultIfNull (Integer value, Integer defaultValue) : Integer Parameters.

Name Type Description

value Integer Value to be checked

defaultValue Integer Default value to be set if value is null Examples.

defaultIfNull(null, 1) = 1 defaultIfNull(20, 1) = 20

1.6. defaultIfNull(Float value, Float defaultValue)

Returns a default value if the provided value is null. Otherwise the given value is returned.

Syntax. defaultIfNull (Float value, Float defaultValue) : Float Parameters.

Name Type Description

value Float Value to be checked

defaultValue Float Default value to be set if value is null Examples.

defaultIfNull(null, 1.0) = 1.0 defaultIfNull(20.0, 1.0) = 20.0

1.7. defaultIfNull(Boolean value, Boolean defaultValue)

Returns a default value if the provided value is null. Otherwise the given value is returned.

(12)

Chapter 1. Arithmetic Functions

Syntax. defaultIfNull (Boolean value, Boolean defaultValue) : Boolean Parameters.

Name Type Description

value Boolean Value to be checked

defaultValue Boolean Default value to be set if value is null Examples.

defaultIfNull(null, false) = false defaultIfNull(true, false) = true

1.8. exp(Float value)

Returns the value of the exponential function.

Syntax. exp (Float value) : Float Parameters.

Name Type Description

value Float Number whose value of the exponential function is determined Examples.

exp(1) = 2.71828182845905 exp(0) = 1

1.9. falseIfNull(Boolean value)

Returns false if the provided value is null. Otherwise the given value is returned.

Syntax. falseIfNull (Boolean value) : Boolean Parameters.

Name Type Description

value Boolean Value to be checked

Examples.

falseIfNull(null) = false falseIfNull(true) = true

1.10. formatNumber(Float number, String pattern)

Formats number with pattern according to the current locale.

Syntax. formatNumber (Float number, String pattern) : String Parameters.

(13)

Chapter 1. Arithmetic Functions

Name Type Description

number Float Number to be formatted

pattern String Pattern defining the format

Examples.

formatNumber(12345, "") = "12,345"

formatNumber(12345, "0.00") = "12345.00"

0 Digit

# Digit, zero shows as absent . Decimal separator

- Minus sign

, Grouping separator

E Separates mantissa and exponent

; Separates positive and negative subpatterns

% Multiply by 100 and show as percentage

‰ Multiply by 1000 and show as mille

¤ Currency symbol ''' Escape character

1.11. formatNumber(Integer number, String pattern)

Formats number with pattern according to the current locale.

Syntax. formatNumber (Integer number, String pattern) : String Parameters.

Name Type Description

number Integer Number to be formatted

pattern String Pattern defining the format

Examples.

formatNumber(12345, "") = "12,345"

formatNumber(12345, "0.00") = "12345.00"

0 Digit

# Digit, zero shows as absent . Decimal separator

- Minus sign

, Grouping separator

E Separates mantissa and exponent

; Separates positive and negative subpatterns

(14)

Chapter 1. Arithmetic Functions

% Multiply by 100 and show as percentage

‰ Multiply by 1000 and show as mille

¤ Currency symbol ''' Escape character

1.12. formatNumber(Float number)

Formats a number Number, using a predefined pattern determined by the current locale.

Syntax. formatNumber (Float number) : String Parameters.

Name Type Description

number Float Number to be formatted

Examples.

formatNumber(12345) = "12345"

1.13. formatNumber(Integer number)

Formats a number Number, using a predefined pattern determined by the current locale.

Syntax. formatNumber (Integer number) : String Parameters.

Name Type Description

number Integer Number to be formatted

Examples.

formatNumber(12345) = "12345"

1.14. formatNumberLocale(Float number, String locale)

Formats number according to the given locale.

Syntax. formatNumberLocale (Float number, String locale) : String Parameters.

Name Type Description

number Float Number to be formatted

locale String Target language code (ISO-639), optional: country (ISO-3166) Examples.

formatNumberLocale(3.14, "de") = 3,14 formatNumberLocale(3.14, "de_CH") = 3.14

(15)

Chapter 1. Arithmetic Functions

1.15. isEqual(Float number1, Float number2, Float delta)

Compares two numbers using a difference value (delta) that determines whether they are considered to be equal.

Syntax. isEqual (Float number1, Float number2, Float delta) : Boolean Parameters.

Name Type Description

number1 Float First number to compare

number2 Float Second number to compare

delta Float Difference value

Examples.

isEqual(0.00000004, 0.000000039, 0.000001) = true isEqual(0.000001, 0.000009, 0.000001) = false

1.16. isInteger(String text)

Returns true if text is representing a whole number.

Syntax. isInteger (String text) : Boolean Parameters.

Name Type Description

text String Text to be checked if it is representing a whole number.

Examples.

isInteger("12345") = true isInteger("12345.67") = false isInteger("12345-") = false

1.17. isNumber(String text)

Returns true if text is representing a number (integer or floating-point).

Syntax. isNumber (String text) : Boolean Parameters.

Name Type Description

text String Text to be checked if it is representing a number Examples.

isNumber("12345") = true isNumber("12345.67") = true isNumber("12345,67") = false

(16)

Chapter 1. Arithmetic Functions

isNumber("12345-") = false

1.18. log(Float value)

Returns the natural logarithm (base e) of a number. If the logarithm can't be calculated (e.g. number is negative or 0) an exception is returned.

Syntax. log (Float value) : Float Parameters.

Name Type Description

value Float Number whose natural logarithm (base e) is determined Examples.

log(2.71828182845905) = 1 log(1) = 0

log(-10) An exception is returned

1.19. log(Float value, Float base)

Returns the logarithm (arbitrary base) of a number. If the logarithm can't be calculated (e.g. number or base is negative or 0) an exception is returned.

Syntax. log (Float value, Float base) : Float Parameters.

Name Type Description

value Float Number whose logarithm (arbitrary base) is determined

base Float Base for the calculation of the logarithm

Examples.

log(100.0, 10.0) = 2.0

log(5.0, 7.0) = 0.8270874753469162 log(-10.0, 10.0) An exception is returned log(10.0, -10.0) An exception is returned

1.20. max(Float List list)

Returns the maximum element of a collection Syntax. max (Float List list) : Float Parameters.

Name Type Description

list Float List List to check

(17)

Chapter 1. Arithmetic Functions

Examples.

max({1,8,2}) = 8

max({2.2,13.6,5.3}) = 13.6

1.21. max(Integer List list)

Returns the maximum element of a collection

Syntax. max (Integer List list) : Integer Parameters.

Name Type Description

list Integer List List to check

Examples.

max({1,8,2}) = 8 max({4,9,2}) = 9

1.22. min(Float List list)

Returns the minimal element of a collection Syntax. min (Float List list) : Float Parameters.

Name Type Description

list Float List List to check

Examples.

min({1,8,2}) = 1 min({2.2,13.6,5.3}) = 2.2

1.23. min(Integer List list)

Returns the minimal element of a collection

Syntax. min (Integer List list) : Integer Parameters.

Name Type Description

list Integer List List to check

Examples.

min({1,8,2}) = 1 min({4,9,2}) = 2

(18)

Chapter 1. Arithmetic Functions

1.24. pow(Float base, Float exponent)

Returns the value of the base to the power of the exponent.

Syntax. pow (Float base, Float exponent) : Float Parameters.

Name Type Description

base Float Value of the base

exponent Float Value of the exponent

Examples.

pow(3, 2) = 9 pow(9, 0.5) = 3

1.25. random()

Returns a random value between 0.0 (inclusive) and 1.0 (exclusive).

Syntax. random () : Float Examples.

random() = 0.9107027392708531

1.26. randomInteger(Integer lowerBound, Integer upperBound)

Generates a random integer value within the interval [lowerBound, upperBound].

Syntax. randomInteger (Integer lowerBound, Integer upperBound) : Integer Parameters.

Name Type Description

lowerBound Integer Lower bound of the interval upperBound Integer Upper bound of the interval Examples.

randomInteger(-2, 2) = 1

1.27. round(Float value)

Rounds a number to the next integer.

Syntax. round (Float value) : Integer Parameters.

Name Type Description

value Float Value to be rounded

(19)

Chapter 1. Arithmetic Functions

Examples.

round(1.6) = 2 round(2.5) = 3 round(5.3) = 5 round(5.499) = 5

1.28. round(Float value, Integer precision)

Rounds a floating-point number to the next number with the given precision.

Syntax. round (Float value, Integer precision) : Float Parameters.

Name Type Description

value Float Value to be rounded

precision Integer Number of decimal places

Examples.

round(1.006,2) = 1.01 round(2.54446,3) = 2.544 round(5.3,2) = 5.3 round(5.499,1) = 5.5

1.29. sgn(Float value)

Returns a value depending on the algebraic sign of a number. This functions returns either 1, 0 or -1 depending on the argument

Syntax. sgn (Float value) : Integer Parameters.

Name Type Description

value Float Number whose algebraic sign is determined

Examples.

sgn(0) = 0 sgn(1.6) = 1 sgn(-5) = -1

1.30. sqrt(Float value)

Returns the square root of a number.

Syntax. sqrt (Float value) : Float

(20)

Chapter 1. Arithmetic Functions

Parameters.

Name Type Description

value Float Number whose square root is determined

Examples.

sqrt(4) = 2 sqrt(9) = 3

1.31. sum(Float List list)

Returns the sum of the values of a collection Syntax. sum (Float List list) : Float Parameters.

Name Type Description

list Float List List to check

Examples.

sum({1, 8, 2}) = 11 sum({2.2, 1.0, 3.1}) = 6.3

1.32. sum(Integer List list)

Returns the sum of the values of a collection

Syntax. sum (Integer List list) : Integer Parameters.

Name Type Description

list Integer List List to check

Examples.

sum({1, 8, 2}) = 11 sum({2, 1, 3}) = 6

1.33. truncate(Float value)

Truncates the fraction of a floating-point number.

Syntax. truncate (Float value) : Integer Parameters.

Name Type Description

value Float Value to be truncated

(21)

Chapter 1. Arithmetic Functions

Examples.

truncate(1.6) = 1 truncate(2.5) = 2 truncate(5.3) = 5

1.34. zeroIfNull(Integer value)

Returns zero if the provided value is null. Otherwise the given value is returned.

Syntax. zeroIfNull (Integer value) : Integer Parameters.

Name Type Description

value Integer Value to be checked

Examples.

zeroIfNull(integerWithNullValue) = 0 zeroIfNull(20) = 20

1.35. zeroIfNull(Float value)

Returns zero if the provided value is null. Otherwise the given value is returned.

Syntax. zeroIfNull (Float value) : Float Parameters.

Name Type Description

value Float Value to be checked

Examples.

zeroIfNull(floatWithNullValue) = 0.0 zeroIfNull(20.0) = 20.0

(22)

Chapter 2. Collection Functions

Chapter 2. Collection Functions

containsAll (Any Collection collection1, Any Collection collection2) : Boolean

copy (Any Collection from) : Any Collection

count (Any List list) : Integer

count (Any Collection collection) : Integer

count (Any Collection collection : Boolean conditionalExpression) : Integer

exists (Any Collection collection : Boolean conditionalExpression) : Boolean

filter (Any Collection collection : Boolean filterExpression) : Any Collection

first (Any Collection collection : Boolean conditionalExpression) : Any

forall (Any Collection collection : Boolean conditionalExpression) : Boolean

isEmpty (Any Collection collection) : Boolean

last (Any Collection collection : Boolean conditionalExpression) : Any

max (Any Collection collection : Any sortExpression) : Any

min (Any Collection collection : Any sortExpression) : Any

rankAsc (Any List list : Any sortExpression, Any element, Integer maxElements) : Any List

rankDesc (Any List list : Any sortExpression, Any element, Integer maxElements) : Any List

select (Any Collection collection : Any expression) : Any Collection

slice (Any List list, Integer begin, Integer end) : Any List

slice (Any List list, Integer begin) : Any List

sortAsc (Any Collection collection : Any sortExpression) : Any List

sortDesc (Any Collection collection : Any sortExpression) : Any List

2.1. containsAll(Any Collection collection1, Any Collection collection2)

Returns true if collection1 contains all elements of collection2 at least once, false otherwise

Syntax. containsAll (Any Collection collection1, Any Collection collection2) : Boolean

Parameters.

Name Type Description

collection1 Any Collection Collection to check whether it contains all elements of the other collection

collection2 Any Collection Collection to check whether its elements are part of the other collection Examples.

containsAll({1,8,2}, {1}) = true

containsAll({"foo","bar","fooo"}, {"ba"}) = false containsAll({false, true}, {true, false}) = true

(23)

Chapter 2. Collection Functions

2.2. copy(Any Collection from)

Creates a copy of a collection and all its elements. The copy() function performs a deep copy, i.e. the collection and all contained elements are copied.

Syntax. copy (Any Collection from) : Any Collection Parameters.

Name Type Description

from Any Collection Collection to be copied

2.3. count(Any List list)

Returns the number of elements contained in the collection.

Syntax. count (Any List list) : Integer Parameters.

Name Type Description

list Any List List whose elements should be counted

Examples.

count({1,8,2,3}) = 4 count({2.0,8.0,3.0}) = 3 count({true,false}) = 2

2.4. count(Any Collection collection)

Returns the number of elements contained in the collection.

Syntax. count (Any Collection collection) : Integer Parameters.

Name Type Description

collection Any Collection Collection whose elements should be counted Examples.

count({1,8,2,3}) = 4 count({2.0,8.0,3.0}) = 3 count({true,false}) = 2

2.5. count(Any Collection collection : Boolean conditionalExpression)

Returns the number of elements in the collection for which the conditional expression evaluates to true.

Syntax. count (Any Collection collection : Boolean conditionalExpression) : Integer Parameters.

(24)

Chapter 2. Collection Functions

Name Type Description

collection Any Collection Collection whose elements should be counted

conditionalExpressionBoolean Expression evaluated for each element in the collection Examples.

count({1,8,2,3} : THIS > 2) = 2

2.6. exists(Any Collection collection : Boolean conditionalExpression)

Returns true if expression is true for at least one element of collection.

Syntax. exists (Any Collection collection : Boolean conditionalExpression) : Boolean Parameters.

Name Type Description

collection Any Collection Collection to check

conditionalExpressionBoolean Expression evaluated for the elements in the collection Examples.

exists({1,8,2,3} : THIS < 0) = FALSE

2.7. filter(Any Collection collection : Boolean filterExpression)

Returns a new collection with those elements of 'collection' for which the expression evaluates to true.

Syntax. filter (Any Collection collection : Boolean filterExpression) : Any Collection

Parameters.

Name Type Description

collection Any Collection Collection to filter

filterExpression Boolean Expression specifying the filter criterion Examples.

filter({1,8,2,3} : THIS < 3) = {1,2}

filter(customers : turnover > 10000)

2.8. first(Any Collection collection : Boolean conditionalExpression)

Returns the first element of the collection for which the conditional expression evaluates to true Syntax. first (Any Collection collection : Boolean conditionalExpression) : Any Parameters.

Name Type Description

collection Any Collection Collection to be checked

(25)

Chapter 2. Collection Functions

Name Type Description

conditionalExpressionBoolean Expression evaluated for the elements in the collection Examples.

first(customers : balance >= 10000) The first customer with over 10000 dollars in his account

2.9. forall(Any Collection collection : Boolean conditionalExpression)

Returns true if expression is true for all elements of collection.

Syntax. forall (Any Collection collection : Boolean conditionalExpression) : Boolean Parameters.

Name Type Description

collection Any Collection Collection to check

conditionalExpressionBoolean Expression evaluated for each element in the collection Examples.

forall({1,8,2,3} : THIS > 0) = TRUE

2.10. isEmpty(Any Collection collection)

Returns true if collection is empty, false otherwise

Syntax. isEmpty (Any Collection collection) : Boolean Parameters.

Name Type Description

collection Any Collection Collection to check whether it's empty or not Examples.

isEmpty({}) = true isEmpty(null) = true isEmpty({1,2,3,4}) = false

2.11. last(Any Collection collection : Boolean conditionalExpression)

Returns the last element of the collection for which the conditional expression evaluates to true Syntax. last (Any Collection collection : Boolean conditionalExpression) : Any Parameters.

Name Type Description

collection Any Collection Collection to be checked

conditionalExpressionBoolean Expression evaluated for the elements in the collection Examples.

(26)

Chapter 2. Collection Functions

last(customers : balance >= 10000) The last customer with over 10000 dollars in his account

2.12. max(Any Collection collection : Any sortExpression)

Returns the maximal element in terms of sortable expression of a collection

Syntax. max (Any Collection collection : Any sortExpression) : Any Parameters.

Name Type Description

collection Any Collection Collection to be checked

sortExpression Any Expression specifying the sort criterion Examples.

max( {1.3, 5, 4.9} : THIS ) = 5

max( customerList : THIS.turnover ) = <customer with highest turnover>

2.13. min(Any Collection collection : Any sortExpression)

Returns the minimal element in terms of sortable expression of a collection

Syntax. min (Any Collection collection : Any sortExpression) : Any Parameters.

Name Type Description

collection Any Collection Collection to be checked

sortExpression Any Expression specifying the sort criterion Examples.

min({1,8,2} : THIS) = 1

min(productList : price) Returns the cheapest product

2.14. rankAsc(Any List list : Any sortExpression, Any element, Integer maxElements)

Inserts the element into the list at the right position so that the list remains correctly sorted ascendingly according to the sort expression. If the resulting list contains more than maxElements elements, the exceeding elements at the end will be removed. The remaining list is returned as the result. Note: This requires the given list to be already sorted ascendingly according to the sort expression.

Syntax. rankAsc (Any List list : Any sortExpression, Any element, Integer maxElements) : Any List

Parameters.

Name Type Description

list Any List Preordered list of elements to be ranked

sortExpression Any Ranking criterion by which the elements will be sorted ascendingly

(27)

Chapter 2. Collection Functions

Name Type Description

element Any The additional element to be inserted

maxElements Integer Maximum number of elements to remain in the list Examples.

rankAsc({1, 2, 3, 5, 6, 7} : THIS, 4, 5) = {1, 2, 3, 4, 5}

2.15. rankDesc(Any List list : Any sortExpression, Any element, Integer maxElements)

Inserts the element into the list at the right position so that the list remains correctly sorted descendingly according to the sort expression. If the resulting list contains more than maxElements elements, the exceeding elements at the end will be removed. The remaining list is returned as the result. Note: This requires the given list to be already sorted descendingly according to the sort expression.

Syntax. rankDesc (Any List list : Any sortExpression, Any element, Integer maxElements) : Any List

Parameters.

Name Type Description

list Any List Preordered list of elements to be ranked

sortExpression Any Ranking criterion by which the elements will be sorted descendingly

element Any The additional element to be inserted

maxElements Integer Maximum number of elements to remain in the list Examples.

rankDesc({7, 6, 5, 3, 2, 1} : THIS, 4, 5) = {7, 6, 5, 4, 3}

2.16. select(Any Collection collection : Any expression)

Returns a new collection with the elements that result from evaluating expression for each element in collection.

Syntax. select (Any Collection collection : Any expression) : Any Collection Parameters.

Name Type Description

collection Any Collection Collection to process

expression Any Expression evaluated for each element in the collection Examples.

select({1,8,2,3} : THIS * 2) = {2,16,4,6}

2.17. slice(Any List list, Integer begin, Integer end)

Returns the sublist from begin to end of list. If end is negative or 0, end+size(list) will be used. If begin is negative or 0, begin+size(list) will be used. If end is larger than the size of the list, all elements up to the end of

(28)

Chapter 2. Collection Functions

list are returned. If begin is smaller than 1, all elements starting from the first will be returned. If begin is larger than end, an empty collection will be returned.

Syntax. slice (Any List list, Integer begin, Integer end) : Any List Parameters.

Name Type Description

list Any List List to process

begin Integer Start index

end Integer End index

Examples.

slice({1,8,2,3}, 2, 3) = {8,2}

slice({1,8,2,3}, 2, -2) = {8}

slice({1,8,2,3}, 3, 2) = {}

slice({1,8,2,3}, -2, 3) = {8,2}

2.18. slice(Any List list, Integer begin)

Returns the sublist from begin to the end of list.

Syntax. slice (Any List list, Integer begin) : Any List Parameters.

Name Type Description

list Any List List to process

begin Integer Start index

Examples.

slice({1,8,2,3}, 2) = {8,2,3}

2.19. sortAsc(Any Collection collection : Any sortExpression)

Sorts the collection by expression in ascending order.

Syntax. sortAsc (Any Collection collection : Any sortExpression) : Any List Parameters.

Name Type Description

collection Any Collection Collection to be sorted

sortExpression Any Expression specifying the sort criterion Examples.

sortAsc({1,3,8,2} : THIS) = {1,2,3,8}

sortAsc(customerList : name) Sorts the customer list by name ascending

(29)

Chapter 2. Collection Functions

sortAsc({"longer", "very long", "tiny"} : length(THIS)) Sorts the Strings by their length ascending

2.20. sortDesc(Any Collection collection : Any sortExpression)

Sorts the collection by expression in descending order.

Syntax. sortDesc (Any Collection collection : Any sortExpression) : Any List Parameters.

Name Type Description

collection Any Collection Collection to be sorted

sortExpression Any Expression specifying the sort criterion Examples.

sortDesc({1,3,8,2} : THIS) = {8,3,2,1}

sortDesc(customerList : name) Sorts the customer list by name descending

sortDesc({"longer", "very long", "tiny"} : length(THIS)) Sorts the Strings by their length descending

(30)

Chapter 3. Map Functions

Chapter 3. Map Functions

copy (Any -> Any Map from) : Any -> Any Map

count (Any -> Any Map map) : Integer

isEmpty (Any -> Any Map map) : Boolean

keys (Any -> Any Map map) : Any Set

values (Any -> Any Map map) : Any Collection

3.1. copy(Any -> Any Map from)

Creates a copy of a Map and all its elements. The copy() function performs a deep copy, i.e. the Map and all contained elements are copied.

Syntax. copy (Any -> Any Map from) : Any -> Any Map Parameters.

Name Type Description

from Any -> Any Map Map to be copied

3.2. count(Any -> Any Map map)

Returns the number of elements contained in the Map.

Syntax. count (Any -> Any Map map) : Integer Parameters.

Name Type Description

map Any -> Any Map Map whose elements should be counted Examples.

count({a:42, b:23}) = 2

3.3. isEmpty(Any -> Any Map map)

Returns true if Map is empty, false otherwise.

Syntax. isEmpty (Any -> Any Map map) : Boolean Parameters.

Name Type Description

map Any -> Any Map Map which should be checked Examples.

isEmpty({}) = true isEmpty(null) = true

isEmpty({1->"value1",2->"value2"}) = false

(31)

Chapter 3. Map Functions

3.4. keys(Any -> Any Map map)

Returns all key elements from the Map.

Syntax. keys (Any -> Any Map map) : Any Set Parameters.

Name Type Description

map Any -> Any Map Map to be checked Examples.

keys({a:1, b:1}) = {a, b}

3.5. values(Any -> Any Map map)

Returns all values of the Map as Collection.

Syntax. values (Any -> Any Map map) : Any Collection Parameters.

Name Type Description

map Any -> Any Map Map to be checked Examples.

values({a:1, b:2}) = {1, 2}

values({a:1, b:2, c:1}) = {1, 2, 1}

(32)

Chapter 4. Date and Time Functions

Chapter 4. Date and Time Functions

addDays (Date date, Integer days) : Date

addDays (Timestamp timestamp, Integer day) : Timestamp

addHours (Time time, Integer hours) : Time

addHours (Timestamp timestamp, Integer hour) : Timestamp

addMillis (Time time, Integer seconds) : Time

addMinutes (Time time, Integer minutes) : Time

addMinutes (Timestamp timestamp, Integer minute) : Timestamp

addMonths (Date date, Integer months) : Date

addMonths (Timestamp timestamp, Integer month) : Timestamp

addSeconds (Time time, Integer seconds) : Time

addSeconds (Timestamp timestamp, Integer seconds) : Timestamp

addTime (Time time1, Time time2) : Time

addYears (Date date, Integer years) : Date

addYears (Timestamp timestamp, Integer year) : Timestamp

currentDate () : Date

currentTime () : Time

currentTimestamp () : Timestamp

date (String text) : Date

date (Integer year, Integer month, Integer day) : Date

date (Timestamp timestamp) : Date

day (Date date) : Integer

dayOfMonth (Date date) : Integer

dayOfMonth (Timestamp timestamp) : Integer

dayOfWeek (Date date) : Integer

dayOfWeek (Timestamp timestamp) : Integer

dayOfYear (Date date) : Integer

dayOfYear (Timestamp timestamp) : Integer

defaultIfNull (Date value, Date defaultValue) : Date

defaultIfNull (Time value, Time defaultValue) : Time

defaultIfNull (Timestamp value, Timestamp defaultValue) : Timestamp

diffDays (Date date1, Date date2) : Integer

diffHours (Time time1, Time time2) : Integer

diffHours (Timestamp timestamp1, Timestamp timestamp2) : Integer

diffMillis (Time time1, Time time2) : Integer

diffMinutes (Time time1, Time time2) : Integer

References

Related documents