.. index:: built-in functions, interpreter ****************************** Interpreter built-in functions ****************************** This API page describes built-in functions defined on Interpreter level. .. index:: Operators Operators ================= Operators underneath the Scolvo script are implemented as builtin functions to provide the flexibility of operator overloading with easy setup. The operator references are resolved into function declaration nodes while parsing the tree. .. index:: assignment operator Assignment operator -------------------- This is the basic assignment operator. Assignment takes a left value that represent a variable reference and any expression as right side. The following operators are currently supported: *Function syntax*:: variable = expression variable += expression variable -= expression variable *= expression variable /= expression variable %= expression variable &= expression variable |= expression .. code-block:: scolvoscript :caption: Example assignments :linenos: // simple assignment var number = 11; // interpreted as variable = variable + expression number += 1; // interpreted as variable = variable - expression number -= 3; // interpreted as variable = variable * expression number *= 4; // interpreted as variable = variable / expression number /= 2; // interpreted as variable = variable % expression number %=10; // interpreted as variable = variable && expression number &= 100; // interpreted as variable = variable || expression number |= 100; .. .. index:: division operator Division operator -------------------- The simple division (/) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example division :linenos: var number = 11; var other = number / 2; .. .. index:: equals operator Equals operator -------------------- The simple equals (==) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example equals usage :linenos: var number = 11; if (number == 11) { info("Equals 11."); } .. .. index:: greater-or-equals operator GreaterOrEquals operator ------------------------- The simple greater or equals (>=) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example greater-or-equals usage :linenos: var number = 11; if (number >= 0) { info("It is a positive number."); } .. .. index:: greater-than operator GreaterThan operator ------------------------- The simple greater than (>) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example greather-than usage :linenos: var number = 11; if (number > -1) { info("It is a non-negative number."); } .. .. index:: less-or-equals operator LessOrEquals operator ------------------------- The simple less or equals (<=) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example less-or-equals :linenos: var roomTemperatureLimit = 26; if (actualTemperature <= roomTemperatureLimit) { info("The air temperature is fine."); } .. .. index:: less-than operator LessThan operator ------------------------- The simple less (<) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example less-than :linenos: var boilingTemperature = 100; if (waterTemperature < boilingTemperature) { info("It is still liquid."); } .. .. index:: logical operators Logical operators ----------------- The simple logical or and and (|| and && respectively) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example logical operator :linenos: if ((liquidType == "WATER" && liquidTemperature < 100 && liquidTemperature > 0) || (liquidType == "ANTIFREEZE_LIQUID" && liquidTemperature < 129 && liquidTemperature > -37)) { info("It is still liquid."); } .. .. index:: minus operator Minus operator ----------------- The simple subtract (-) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example minus operator :linenos: var number = 10; var remaining = number - 2; .. .. index:: modulus operator Modulus operator ----------------- The simple modulus (%) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example modulus operator :linenos: var amount = 100; var numOfEmployees = 3; var remaining = amount % numOfEmployees; .. .. index:: multiplication operator Multiplication operator ------------------------ The simple multiplication (*) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example multiplication operator :linenos: var wishAttemptsForOnePerson = 3; var numOfEmployees = 3; var sumOfWishes = wishAttemptsForOnePerson * numOfEmployees; .. .. index:: plus operator Plus operator ------------- The simple addition (+) operator implemented to be fully compatible with it's definition in most programming and mathematical contexts. .. code-block:: scolvoscript :caption: Example plus operator :linenos: var limit = 300; var punctuationDelta = 4; if (actualPoints > limit + delta) { info("It is OK."); } .. .. index:: operator precedence Operator precedence -------------------- Here's the complete table of operator precedence, that is the exact copy of how `Java implements it `__. .. index:: String built-in functions String functions ================= This goup defines the syntax and definition of String related built-in functions. .. index:: decimalFormat() built-in function decimalFormat() --------------- This function returns the formatted String of the given number according to the given decimal format string. *Function syntax* .. String decimalFormat(number, formatString) .. code-block:: scolvoscript :caption: Example decimalFormat() function call :linenos: var number = java.lang.Integer("10"); var str = decimalFormat(number, "##"); .. .. index:: isNumber() built-in function isNumber() ----------- This function checks if the given number Sting is a number or not. *Function syntax* .. Boolean isNumber(numberString) Or Boolean isNumber(numberString, decimalSeparator, groupingSeparator) where the numberString is given as String and if the the decimal and grouping separators are used, then these should be given as Strings too. .. code-block:: scolvoscript :caption: Example isNumber() function call :linenos: var resultInt = isNumber("20"); var resultDecimal = isNumber("30.5"); var resultDecimalWithSymbols = isNumber("40 000,5", ",", " "); .. .. index:: parseNumber() built-in function parseNumber() ------------- This function converts the given String to number (according to the optionally given format parameters). *Function syntax* .. Number parseNumber(numberString) Or Number parseNumber(numberString, decimalSeparator, groupingSeparator) where the numberString is given as String and if the the decimal and grouping separators are used, then these should be given as Strings too. .. code-block:: scolvoscript :caption: Example parseNumber() function call :linenos: var resultInt = parseNumber("20"); var resultDecimal = parseNumber("30.5"); var resultDecimalWithSymbols = parseNumber("40 000,5", ",", " "); .. .. index:: stringFormat() built-in function stringFormat() -------------- This function takes the given format pattern String and combines with the given format data parameter. *Function syntax* .. String stringFormat(formatPattern, formatData) Or String stringFormat(formatPattern, formatDataList) where the formatPattern is given as String and the formatData is given as String, formatDataList list is consists of Strings too. .. code-block:: scolvoscript :caption: Example stringFormat() function call :linenos: var stringFormatPattern = "Hello %s!"; var stringFormatData = "World"; var formattedString = stringFormat(stringFormatPattern, stringFormatData); var stringFormatPattern = "Hello %s, Bye %s!"; var stringFormatFirstData = "World"; var stringFormatSecondData = "Bye"; var formattedString = stringFormat(stringFormatPattern, [stringFormatFirstData, stringFormatSecondData]); .. .. index:: Date built-in functions Date functions ============== This goup defines the syntax and definition of Date related built-in functions. .. index:: now() built-in function now() ----- This function returns the system date-time in java.util.Date format. *Function syntax* .. Date now() .. code-block:: scolvoscript :caption: Example now() function call :linenos: var actualDateTime = now(); .. .. index:: nowInMillis() built-in function nowInMillis() ------------- This function returns the system timestamp in java.util.Long format. *Function syntax* .. Long nowInMillis() .. code-block:: scolvoscript :caption: Example nowInMillis() function call :linenos: var timestamp = nowInMillis(); .. .. index:: dateToString() built-in function dateToString() -------------- This function transforms the given date or timestamp according to the given format and returns as String. The format string is as described in `Java API SimpleDateFormat documentation `_. *Function syntax* .. String dateToString(Date or timestamp, "format string") .. code-block:: scolvoscript :caption: Example dateToString() function call :linenos: info("The actual date-time in Hungarian format is: " + dateToString(nowInMillis(), "yyyy.MM.dd. HH:mm")); .. .. index:: parseStringToDate() built-in function parseStringToDate() ------------------- This function transforms the given date string according to the given format and returns as java.util.Date. The format string is as described in `Java API SimpleDateFormat documentation `_. *Function syntax* .. Date parseStringToDate("Date in string format", "format string") .. code-block:: scolvoscript :caption: Example parseStringToDate() function call :linenos: var meetingDateString = "2021.04.01 10:10"; var meetingDate = parseStringToDate(meetingDateString, "yyyy.MM.dd. HH:mm"); .. .. index:: dateBefore() built-in function dateBefore() ------------ This function checks the two Date or timestamp parameters: it tests if the first date is before the date defined by the second parameter. The result is returned in form of Boolean. *Function syntax* .. Boolean dateBefore(Date or timestamp as first parameter, Date or timestamp as second parameter) .. code-block:: scolvoscript :caption: Example dateBefore() function call :linenos: if (dateBefore(parseStringToDate("2021.04.01 10:10", "yyyy.MM.dd. HH:mm"), now()) { info("You can do whatever you want, you still have time until the meeting."); } else { info("Meeting time!"); } .. .. index:: dateAfter() built-in function dateAfter() ----------- This function checks the two Date or timestamp parameters: it tests if the first date is after the date defined by the second parameter. The result is returned in form of Boolean. *Function syntax* .. Boolean dateAfter(Date or timestamp as first parameter, Date or timestamp as second parameter) .. code-block:: scolvoscript :caption: Example dateAfter() function call :linenos: if (dateAfter(parseStringToDate("2021.04.01 10:10", "yyyy.MM.dd. HH:mm"), now()) { info("The meeting is ongoing."); } else { info("Prepare for the meeting, you still have time!"); } .. .. index:: dateSame() built-in function dateSame() ---------- This function checks the two Date or timestamp parameters: it tests if they are the same, where the comparison is according to the *unit* parameter. The result is returned in form of Boolean. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Comparison * - year - true if the year values of the two dates are equal * - month - true if the year and month values of the two dates are equal * - week - true if the week of year and year values of the two dates are equal * - day - true if day of year and year values of the two dates are equal * - hour - true if hour of day, day of year and year values of the two dates are equal * - minute - true if minute, hour of day,day of year and year values of the two dates are equal * - seconds - true if seconds, minute, hour of day, day of year and year values of the two dates are equal *Function syntax* .. Boolean dateSame(Date or timestamp as first parameter, Date or timestamp as second parameter, unit paramer as String) .. code-block:: scolvoscript :caption: Example dateSame() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); if (dateSame(baseDate, now(), "week")) { info("Prepare for the meeting, it is this week!"); } else { info("You don't have to prepare for the meeiting, it isn't this week."); } .. .. index:: dateDifference() built-in function dateDifference() ---------------- This function calculates the differentce of the two Date or timestamp parameters according to the *unit* parameter and retuns the absolute value as Integer. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Comparison * - year - returns the absolute value of the difference of the year values of the two dates * - month - returns the absolute value of the difference of the month values of the two dates considering the years too (2020.12 and 2019.11 results 13) * - week - returns the absolute value of the difference of the two dates in days and converted to weeks * - day - returns the absolute value of the difference of the two dates in days * - hour - returns the absolute value of the difference of the two dates in hours * - minute - returns the absolute value of the difference of the two dates in minutes * - seconds - true if seconds, minute, hour of day, day of year and year values of the two dates are equal *Function syntax* .. Integer dateDifference(Date or timestamp as first parameter, Date or timestamp as second parameter, unit paramer as String) .. code-block:: scolvoscript :caption: Example dateDifference() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); if (dateDifference(baseDate, now(), "week") == 0) { info("Prepare for the meeting, it is this week!"); } else { info("You don't have to prepare for the meeiting, it isn't this week."); } .. .. index:: dateAdd() built-in function dateAdd() --------- This function adds the given *amount* (can be any integer) of the given *unit* to the Date or timestamp parameter and returns it as java.util.Date. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Calculation * - year - adds desired times 1 year to the base date * - month - adds desired times 1 month to the base date * - week - adds desired times 1 week to the base date * - day - adds desired times 1 day to the base date * - hour - adds desired times 1 hour to the base date * - minute - adds desired times 1 minute to the base date * - seconds - adds desired times 1 second to the base date *Function syntax* .. Date dateAdd(Date or timestamp as first parameter, amount as Integer, unit paramer as String) .. code-block:: scolvoscript :caption: Example dateAdd() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); info("You have to start meeting preparation at " + dateAdd(baseDate, -7, "day")); .. .. index:: dateSubtract() built-in function dateSubtract() -------------- This function subtracts the given *amount* (can be any integer) of the given *unit* from the Date or timestamp parameter and returns it as java.util.Date. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Calculation * - year - substracts desired times 1 year to the base date * - month - substracts desired times 1 month to the base date * - week - substracts desired times 1 week to the base date * - day - substracts desired times 1 day to the base date * - hour - substracts desired times 1 hour to the base date * - minute - substracts desired times 1 minute to the base date * - seconds - substracts desired times 1 second to the base date *Function syntax* .. Date dateSubtract(Date or timestamp as first parameter, amount as Integer, unit paramer as String) .. code-block:: scolvoscript :caption: Example dateSubtract() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); info("You have to start meeting preparation at " + dateSubtract(baseDate, 7, "day")); .. .. index:: firstDay() built-in function firstDay() ---------- This function return the first day calculated based on the given Date or timestamp and on the given *unit*, and returns the result in form of java.util.Date. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Calculation * - year - returns the first day of the year based on the parameter (at time 00:00:00) * - month - returns the first day of the month based on the parameter (at time 00:00:00) * - week - returns the first day of the week based on the parameter (at time 00:00:00) *Function syntax* .. Date firstDay(Date or timestamp as first parameter, unit paramer as String) .. code-block:: scolvoscript :caption: Example firstDay() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); if (dateAfter(now(), firstDay(baseDate, "week"))) { info("You have to start meeting preparation, it is this week."); } .. .. index:: lastDay() built-in function lastDay() --------- This function return the last day calculated based on the given Date or timestamp and on the given *unit*, and returns the result in form of java.util.Date. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Calculation * - year - returns the last day of the year based on the parameter (at time 00:00:00) * - month - returns the last day of the month based on the parameter (at time 00:00:00) * - week - returns the last day of the week based on the parameter (at time 00:00:00) *Function syntax* .. Date lastDay(Date or timestamp as first parameter, unit paramer as String) .. code-block:: scolvoscript :caption: Example lastDay() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); if (dateAfter(now(), lastDay(dateSubtract(baseDate, 1, "week"), "week"))) { info("You have to start meeting preparation, it is this week."); } .. .. index:: weekOfDate() built-in function weekOfDate() ------------ This function returns the week number calculated based on the given Date or timestamp and on the given *unit*, and returns the result as Integer. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Calculation * - year - returns the week of year of the given date * - month - returns the week of month of the given date *Function syntax* .. Integer weekOfDate(Date or timestamp as first parameter, unit paramer as String) .. code-block:: scolvoscript :caption: Example weekOfDate() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); info("The meeting is on " + weekOfDate(baseDate, "year") + "th week."); .. .. index:: dayOfDate() built-in function dayOfDate() ----------- This function returns the day number calculated based on the given Date or timestamp and on the given *unit*, and returns the result as Integer. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Calculation * - year - returns the day of year of the given date * - month - returns the day of month of the given date * - week - returns the day of week of the given date (Sunday is 0) *Function syntax* .. Integer dayOfDate(Date or timestamp as first parameter, unit paramer as String) .. code-block:: scolvoscript :caption: Example dayOfDate() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); info("The meeting is on " + dayOfDate(baseDate, "week") + "th day of the week."); .. .. index:: partOfDate() built-in function partOfDate() ------------ This function returns the part of the given Date or timestamp based on the given *unit*, and returns the result as Integer. .. list-table:: Valid values of the *unit* parameter :widths: 10 50 :header-rows: 1 * - Value - Calculation * - year - returns the year of the given date * - month - returns the month of the given date (January results 1) * - day - returns the day of the month of the given date * - hour - returns the hour of the given date * - minute - returns the minute of the given date * - second - returns the second of the given date * - millisecond - returns the millisecond of the given date *Function syntax* .. Integer partOfDate(Date or timestamp as first parameter, unit paramer as String) .. code-block:: scolvoscript :caption: Example partOfDate() function call :linenos: var baseDate = parseStringToDate("2021.04.28 10:10", "yyyy.MM.dd. HH:mm"); info("The meeting starts at " + partOfDate(baseDate, "hour") + ":" + partOfDate(baseDate, "minute") + "."); .. Util functions ============== This goup defines the syntax and definition of utility built-in functions. .. index:: uuid() built-in function uuid() ------ This function returns a new random generated Type 4 UUID in form of String. *Function syntax* .. Date uuid() .. code-block:: scolvoscript :caption: Example uuid() function call :linenos: var id = uuid(); .. .. index:: toList() built-in function toList() -------- This function returns the received array as List of boxed types. *Function syntax* .. List toList(any-type-of-array) .. code-block:: scolvoscript :caption: Example toList() function call :linenos: var myBites = toList("one two three".getBytes());; .. .. index:: sendDataChange() built-in function sendDataChange() ---------------- This function sends a data change to the Backend, where the first parameter defines the TypeDefinition (table name) and the second parameter defines the change set in form of array of maps. *Function syntax* .. void sendDataChange(type definition name, change set) .. code-block:: scolvoscript :caption: Example sendDataChange() function call :linenos: var changeSet = [{"changeType":"INSERT", "id":"12345", "other_key": "other value"}]; sendDataChange("myTypeDefinitionName", changeSet); .. Type Definition Extension functions =================================== This goup defines the syntax and definition of Type Definition Extension built-in functions. These functions are helper functions to execute database change sets in the client's database. .. Note:: The change set parameter may contain "changeType" key defining the type of the change, but in the below functions the value of this key is not considered (simply skipped). .. _insertOrReplaceTypeDefinition_built_in_function: .. index:: insertOrReplaceTypeDefinition() built-in function insertOrReplaceTypeDefinition() ------------------------------- This function executes the change set on the client's database, if the given id exists, then an UPDATE operation, otherwise an INSERT operation with the given data is executed on the TypeDefinition (table name). *Function syntax* .. void insertOrReplaceTypeDefinition(type definition name, change set) .. code-block:: scolvoscript :caption: Example insertOrReplaceTypeDefinition() function call :linenos: var changeSet = {"changeType":"INSERT", "id":"12345", "other_key": "other value"}; insertOrReplaceTypeDefinition("myTypeDefinitionName", changeSet); .. .. _insertTypeDefinition_built_in_function: .. index:: insertTypeDefinition() built-in function insertTypeDefinition() ---------------------- This function executes an INSERT operation with the given data on the client's database on the TypeDefinition (table name). *Function syntax* .. void insertTypeDefinition(type definition name, change set) .. code-block:: scolvoscript :caption: Example insertTypeDefinition() function call :linenos: var changeSet = {"changeType":"INSERT", "id":"12345", "other_key": "other value"}; insertTypeDefinition("myTypeDefinitionName", changeSet); .. .. _updateTypeDefinition_built_in_function: .. index:: updateTypeDefinition() built-in function updateTypeDefinition() ---------------------- This function executes an UPDATE operation with the given data on the client's database on the TypeDefinition (table name). *Function syntax* .. void updateTypeDefinition(type definition name, record id as String, change set) .. code-block:: scolvoscript :caption: Example updateTypeDefinition() function call :linenos: var changeSet = {"changeType":"UPDATE", "other_key": "other value"}; updateTypeDefinition("myTypeDefinitionName", "12345", changeSet); .. .. _deleteTypeDefinition_built_in_function: .. index:: deleteTypeDefinition() built-in function deleteTypeDefinition() ---------------------- This function executes a DELETE operation with the given id on the client's database on the TypeDefinition (table name). *Function syntax* .. void deleteTypeDefinition(type definition name, record id as String) .. code-block:: scolvoscript :caption: Example deleteTypeDefinition() function call :linenos: deleteTypeDefinition("myTypeDefinitionName", "12345"); .. .. index:: Builder built-in functions Builder functions =================================== This goup defines the syntax and definition of Builder built-in functions. These functions are helper functions to create event objects manipulating the UI elements. There are two major groups: **Target Events** modifying the UI elements and **Source Events** binding listeners to reactive UI elements. Beside these there is a small gorup with functions helping in UI definition. The created event objects are executed using *fireEvent(event object, originId as String)* built-in function, where the *originId* parameter is usually the name of the container page. The originId for **Traget Events** can be any string if the event is created for elements of same page, must be the name of the other page when the targeted item is on different page. The originId for **Source Events** can be any string. .. index:: createTargetEvent() built-in function createTargetEvent() ------------------- This function is a base function for the **Target Event** group, for customization purposes it is available as built-in function too. It creates a Target Event object in form of Map from the given parameters. *Function syntax* .. Map createTargetEvent(target element id as String, target event type as String, event data in form of Object) .. code-block:: scolvoscript :caption: Example createTargetEvent() function call :linenos: var newItem = { "id": "1234", "title": "My new note title", "description": "To have an example item" }; var event = createTargetEvent("NoteList", "onAddItem", newItem); fireEvent(event, "NotesPage"); .. .. index:: createSourceEvent() built-in function createSourceEvent() ------------------- This function is a base function for the **Source Event** group, for customization purposes it is available as built-in function too. It creates a Source Event object in form of Map from the given parameters. The trigger name parameter is extended by the Interpreter with the "on" prefix, so in the given example a function with name *onAddNoteButtonClicked(originId)* has to be written. *Function syntax* .. Map createSourceEvent(source element id as String, source event type as String, trigger name as String) .. code-block:: scolvoscript :caption: Example createSourceEvent() function call :linenos: fireEvent(createSourceEvent("AddNoteButton", "onClick", "AddNoteButtonClicked"), "NotesPage"); .. .. index:: createSelectOption() built-in function createSelectOption() -------------------- This function is a helper function to create a drop-down list option. It creates an Option object in form of Map based on the given parameters. *Function syntax* .. Map createSelectOption(id of selected item as String, value describing the option as String, is default option as boolean) .. code-block:: scolvoscript :caption: Example createSelectOption() function call :linenos: var options = [ createSelectOption("yes", DICTIONARY.yes, true), createSelectOption("no", DICTIONARY.no, false), createSelectOption("maybe", DICTIONARY.maybe, false) ]; .. .. index:: createMultiSelectOption() built-in function createMultiSelectOption() ------------------------------ This function is a helper function to create a multi-selectable drop-down list option. It creates an Option object in form of Map based on the given parameters. *Function syntax* .. Map createMultiSelectOption(id of selected item as String, value describing the option as String, isChecked boolean value) .. code-block:: scolvoscript :caption: Example createMultiSelectOption() function call :linenos: var acceptableFruitOptions = [ createMultiSelectOption("apple", DICTIONARY.apple, true), createMultiSelectOption("pear", DICTIONARY.pear, false), createMultiSelectOption("lemon", DICTIONARY.lemon, false), createMultiSelectOption("melon", DICTIONARY.melon, true), ]; .. .. _create_short_toast_notification: .. index:: createShortToastNotificationTargetEvent() built-in function createShortToastNotificationTargetEvent() ------------------------------------------ This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then a toast notification is diplayed on the UI for a short time period (the value is defined by the client type, it is 3 seconds for webapp type). *Function syntax* .. Map createShortToastNotificationTargetEvent(message to be presented as String) .. code-block:: scolvoscript :caption: Example createShortToastNotificationTargetEvent() function call :linenos: fireEvent(createShortToastNotificationTargetEvent("My message content"), "NotesPage"); .. .. index:: createAddItemTargetEvent() built-in function createAddItemTargetEvent() -------------------------- This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then a new item is added the UI element. *Function syntax* .. Map createAddItemTargetEvent(target element id as String, new item in form of Map) .. code-block:: scolvoscript :caption: Example createAddItemTargetEvent() function call :linenos: var event = createAddItemTargetEvent("NoteList", { "id": "1234", "title": "My new note title", "description": "To have an example item" }); fireEvent(event, "NotesPage"); .. .. index:: createReplaceItemTargetEvent() built-in function createReplaceItemTargetEvent() ------------------------------ This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then an existing item (identified by the id) replaced by the new value in the UI element. *Function syntax* .. Map createReplaceItemTargetEvent(target element id as String, new item value in form of Map) .. code-block:: scolvoscript :caption: Example createReplaceItemTargetEvent() function call :linenos: var event = createReplaceItemTargetEvent("NoteList", { "id": "1234", "title": "New value of the title", "description": "New value of the description" }); fireEvent(event, "NotesPage"); .. .. index:: createRefreshItemTargetEvent() built-in function createRefreshItemTargetEvent() ------------------------------ This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then the whole item set of the referred UI element is replaced by the items paramter (where the definition of an item is given in form of Map). *Function syntax* .. Map createRefreshItemTargetEvent(target element id as String, new items as array of item definitions) .. code-block:: scolvoscript :caption: Example createRefreshItemTargetEvent() function call :linenos: var event = createRefreshItemTargetEvent("NoteList", [{ "id": "1", "title": "Title of the item", "description": "Description of the item" }, { "id": "2", "title": "Title of the second item", "description": "Description of the second item" } ]); fireEvent(event, "NotesPage"); .. .. index:: createRemoveItemTargetEvent() built-in function createRemoveItemTargetEvent() ------------------------------ This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then an item is removed from the item set of the referred UI element. *Function syntax* .. Map createRemoveItemTargetEvent(target element id as String, item id as String) .. code-block:: scolvoscript :caption: Example createRemoveItemTargetEvent() function call :linenos: fireEvent(createRemoveItemTargetEvent("NoteList", "1"), "NotesPage"); .. .. index:: createValueChangeTargetEvent() built-in function createValueChangeTargetEvent() ------------------------------ This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then the value of the UI element is set to the given parameter value. *Function syntax* .. Map createValueChangeTargetEvent(target element id as String, appropriate item value as Object) .. code-block:: scolvoscript :caption: Example createValueChangeTargetEvent() function call :linenos: fireEvent(createValueChangeTargetEvent("DescriptionInput", "New value of the text input"), "NotesPage"); .. .. index:: createErrorValueChangeTargetEvent() built-in function createErrorValueChangeTargetEvent() ----------------------------------- This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then the error value ( e.g. validation error message) of the UI element is set to the given value. *Function syntax* .. Map createErrorValueChangeTargetEvent(target element id as String, error description as String) .. code-block:: scolvoscript :caption: Example createErrorValueChangeTargetEvent() function call :linenos: fireEvent(createErrorValueChangeTargetEvent("DescriptionInput", "The given value is too long, the maximum enabled lenght is 50."), "NotesPage"); .. .. index:: createEnableChangeTargetEvent() built-in function createEnableChangeTargetEvent() ------------------------------- This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then the UI element is set to enabled or disabled according to the given value. *Function syntax* .. Map createEnableChangeTargetEvent(target element id as String, is enabled as Boolean) .. code-block:: scolvoscript :caption: Example createEnableChangeTargetEvent() function call :linenos: fireEvent(createEnableChangeTargetEvent("DescriptionInput", true), "NotesPage"); .. .. index:: createVisibilityChangeTargetEvent() built-in function createVisibilityChangeTargetEvent() ----------------------------------- This function is in the **Target Event** group, it results a Target Event object in form of Map based on the given parameters. When this event is fired, then the visibility of the referred UI element is set according to the given value. Valid visibility status values are: "visible", "gone" and "invisible", where: .. list-table:: Meaning of values :widths: 10 50 :header-rows: 1 * - Value - Description * - visible - The UI element is visible * - invisible - The UI element is not visible, but he containing space is kept * - gone - The UI element is not visible, and the containing space is not kept *Function syntax* .. Map createVisibilityChangeTargetEvent(target element id as String, visibility status as String) .. code-block:: scolvoscript :caption: Example createVisibilityChangeTargetEvent() function call :linenos: fireEvent(createVisibilityChangeTargetEvent("DescriptionInput", "gone"), "NotesPage"); .. .. index:: createValueChangeSourceEvent() built-in function createValueChangeSourceEvent() ----------------------------------- This function is in the **Source Event** group, it results a Source Event object in form of Map based on the given parameters. When this event is fired, then the given trigger is bound to value change event of the UI element. The system adds an "on" prefix to the trigger name. In the example below a function with name *onDescriptionInputChanged(originId)* has to be implemented. *Function syntax* .. Map createValueChangeSourceEvent(target element id as String, trigger name to be bound as String) .. code-block:: scolvoscript :caption: Example createValueChangeSourceEvent() function call :linenos: fireEvent(createValueChangeSourceEvent("DescriptionInput", "DescriptionInputChanged"), "NotesPage"); .. .. index:: createSelectionChangeSourceEvent() built-in function createSelectionChangeSourceEvent() ----------------------------------- This function is in the **Source Event** group, it results a Source Event object in form of Map based on the given parameters. When this event is fired, then the given trigger is bound to selection change event of the UI element (where this event is available). The system adds an "on" prefix to the trigger name. In the example below a function with name *onActivityYesNoOptionsInputSelectionChanged(originId)* has to be implemented. *Function syntax* .. Map createSelectionChangeSourceEvent(target element id as String, trigger name to be bound as String) .. code-block:: scolvoscript :caption: Example createSelectionChangeSourceEvent() function call :linenos: fireEvent(createSelectionChangeSourceEvent("ActivityYesNoOptionsInput", "ActivityYesNoOptionsInputSelectionChanged"), "NotesPage"); .. .. index:: createClickSourceEvent() built-in function createClickSourceEvent() ------------------------ This function is in the **Source Event** group, it results a Source Event object in form of Map based on the given parameters. When this event is fired, then the given trigger is bound to selection clicked event of the UI element (where this event is available). The system adds an "on" prefix to the trigger name. In the example below a function with name *onSaveOrderButtonClicked(originId)* has to be implemented. *Function syntax* .. Map createClickSourceEvent(target element id as String, trigger name to be bound as String) .. code-block:: scolvoscript :caption: Example createClickSourceEvent() function call :linenos: fireEvent(createClickSourceEvent("SaveOrderButton", "SaveOrderButtonClicked"), "NotesPage"); .. .. index:: Math built-in functions Math functions ============== This goup defines the syntax and definition of Math built-in functions. These functions are implementing basic math operations. The Scolvo Script uses two basic types for number values: BigInteger and BigDecimal. If any of the function params is given as BigDecimal then the result is given in BigDecimal format, otherwise the result is given as BigInteger. .. index:: abs() built-in function abs() ----- This function returns the absolute value of the given number. *Function syntax* .. BigInteger abs(value as BigInteger) or BigDecimal abs(value as BigDecimal) .. code-block:: scolvoscript :caption: Example abs() function call :linenos: var difference = abs(valueOfFirstCalculation - valueOfSecondCalculation); .. .. index:: pow() built-in function pow() ----- This function returns a first parameter raised to the power of the number given in the second parameter. If any of the parameters is given as BigDecimal, then the result is also given as BigDecimal, otherwise it is given as BigInteger. *Function syntax* .. BigInteger or BigDecimal pow(base as BigInteger or BigDecimal, exponential as BigInteger or BigDecimal) .. code-block:: scolvoscript :caption: Example pow() function call :linenos: var amount = 1000; var interestRate = 1.1; var termInYears = 3; var debt = amount * pow(interestRate, termInYears); .. .. index:: min() built-in function min() ----- This function returns the minimum of the given values. If any of the parameters is given as BigDecimal, then the result is also given as BigDecimal, otherwise it is given as BigInteger. *Function syntax* .. BigInteger or BigDecimal min(first as BigInteger or BigDecimal, second as BigInteger or BigDecimal) .. code-block:: scolvoscript :caption: Example min() function call :linenos: var amount = 1000; var termInYears = 3; var bestCaseResult = min(calculateDebtOtpBank(amount, termInYears), calculateDebtKAndHBank(amount, termInYears)); .. .. index:: max() built-in function max() ----- This function returns the maximum of the given values. If any of the parameters is given as BigDecimal, then the result is also given as BigDecimal, otherwise it is given as BigInteger. *Function syntax* .. BigInteger or BigDecimal max(first as BigInteger or BigDecimal, second as BigInteger or BigDecimal) .. code-block:: scolvoscript :caption: Example max() function call :linenos: var amount = 1000; var termInYears = 3; var worstCaseResult = max(calculateDebtOtpBank(amount, termInYears), calculateDebtKAndHBank(amount, termInYears)); .. .. index:: sqrt() built-in function sqrt() ------ This function returns the correctly rounded positive square root of the given value. *Function syntax* .. BigDecimal sqrt(value as BigInteger or BigDecimal) .. code-block:: scolvoscript :caption: Example sqrt() function call :linenos: var result = sqrt(2); .. .. index:: Logger built-in functions Logger functions ================ This goup defines the syntax and definition of Logger built-in functions. These functions can be used to log information to the client's log. Supported levels are: error, warn, info, debug, trace. All functions receive the message parameter as String and there is no return value. .. index:: error() built-in function error() ------- This function logs an error to the client's log. *Function syntax* .. void error(message as String) .. code-block:: scolvoscript :caption: Example error() function call :linenos: if (value == null) { error("Unsupported value when performing save: " + value); } .. .. index:: warn() built-in function warn() ------ This function logs a warning to the client's log. *Function syntax* .. void warn(message as String) .. code-block:: scolvoscript :caption: Example warn() function call :linenos: if (value != null && value > 500) { warn("The given value is too high: " + value); doSomeCalculation(value); } .. .. index:: info() built-in function info() ------ This function logs an info level message to the client's log. *Function syntax* .. void info(message as String) .. code-block:: scolvoscript :caption: Example info() function call :linenos: if (value != null) { info("The given value is: " + value); doSomeCalculation(value); } .. .. index:: debug() built-in function debug() ------- This function logs a debug level message to the client's log. *Function syntax* .. void debug(message as String) .. code-block:: scolvoscript :caption: Example debug() function call :linenos: if (value != null) { debug("The given value is: " + value); info("Performing some calculation ..."); doSomeCalculation(value); } .. .. index:: trace() built-in function trace() ------- This function logs a trace level message to the client's log. *Function syntax* .. void trace(message as String) .. code-block:: scolvoscript :caption: Example trace() function call :linenos: if (value != null) { var tmpResult = doSomeCalculation(value); trace("The result of the calculation is: " + tmpResult); } .. .. index:: ReactiveX built-in functions ReactiveX functions =================== This goup defines the syntax and definition of so called ReactiveX functions working mainly in publish-subscribe manner. These functions can be used to send messages for other components. These components are specific components of the Clients. .. index:: publish() built-in function publish() --------- This function broadcasts a message, and the subscribed components receive this message to handle. The message can be any kind of Object. This function is available for customization purposes, all known usage is implemented in specific built-in functions (the given example is supported by *sendDataChange()* built-in function). *Function syntax* .. void publish(message as Object) .. code-block:: scolvoscript :caption: Example publish() function call :linenos: var dataChangeMsg = com.scolvo.core.vm.action.rq.DataChangeRq(uuid()); dataChangeMsg.setTypeDefinition("notes"); dataChangeMsg.setTypeDefinitionVersion(nowInMillis()); dataChangeMsg.setChangeset([{"id": "1", "title": "actual title","description": "Actual description", "changeType": "INSERT"}]); publish(dataChangeMsg); .. .. index:: trigger() built-in function trigger() --------- This function broadcast a TriggerScript object, where the trigger name is given in form of String. As a result the Interpreter executes the function with the given name. This function is available for customization purposes. *Function syntax* .. void trigger(trigger name as String) .. code-block:: scolvoscript :caption: Example trigger() function call :linenos: trigger("NoteSaveButtonClicked"); .. .. index:: fireEvent() built-in function fireEvent() ----------- This function fires an event given as Map. *Function syntax* .. void fireEvent(event map as Map, originId as String) .. code-block:: scolvoscript :caption: Example fireEvent() function call :linenos: var event = createReplaceItemTargetEvent("NoteList", { "id": "1234", "title": "New value of the title", "description": "New value of the description" }); fireEvent(event, "NotesPage"); .. .. index:: display() built-in function display() --------- This function displays a page (see :ref:`Page element`) on the UI. The function can be invoked with 3 and 4 parameters too. *Function syntax* .. void display(page as Page object, page data as Map, originId as String) or void display(page as Page object, page data as Map, originId as String, page actions as array of actions) .. code-block:: scolvoscript :caption: Example display() function call :linenos: if (pageActions == null) { display(NotesPage, {}, originId); } else { display(NotesPage, {}, originId, pageActions); } .. .. index:: displayFragment() built-in function displayFragment() ----------------- This function displays a fragment in a fragment container of the UI. The function can be invoked with 4 and 5 parameters too. *Function syntax* .. void displayFragment(fragment container name as String, fragment as Fragment object, fragment data as Map, originId as String) or void displayFragment(fragment container name as String, fragment as Fragment object, fragment data as Map, originId as String, fragment actions as array of actions) .. code-block:: scolvoscript :caption: Example displayFragment() function call :linenos: if (type == "note") { displayFragment("DetailsFragmentContainer", NoteDetailsFragment, {}, originId); } else { displayFragment("DetailsFragmentContainer", ItemDetailsFragment, {}, originId, []); } .. .. index:: finishPage() built-in function finishPage() ------------ This function closes a Page and removes it from page history. *Function syntax* .. void finishPage(page name as String, originId as String) .. code-block:: scolvoscript :caption: Example finishPage() function call :linenos: finishPage("NoteDetailsPage", originId); .. .. index:: QueryBuilder built-in functions QueryBuilder functions ======================= This goup defines the syntax and definition of usages of QueryBuilder functionality working with client's database. There are two kind of methods: chaining methods and termination methods. The chanining methods create or changes a QueryBuilder instance, the termination methods are using or mofifying the QueryBuilder (executes the query on the database or calculates something from the QueryBuilder object). .. index:: insert() built-in function insert() --------- This function is a chanining function, it creates a QueryBuilder object with **INSERT** query type. *Function syntax* .. QueryBuilder insert() .. code-block:: scolvoscript :caption: Example insert() function call :linenos: var insertUserQuery = insert().from("note"); insertUserQuery.set("id", uuid()); insertUserQuery.set("title", "New title"); insertUserQuery.set("content", "New content"); insertUserQuery.execute(); .. .. Note:: When inserting to the database it is simpler to use :ref:`insertTypeDefinition() built-in function`. .. index:: insertOrReplace() built-in function insertOrReplace() ----------------- This function is a chanining function, it creates a QueryBuilder object with **insertOrReplace** query type (REPLACE INTO database operation). It is usually used when client receives data change from Backend, where the originator can be the client itself. In this case an *insert* function can fail, but an *insertOrReplace* is successfull anyway. *Function syntax* .. QueryBuilder insertOrReplace() .. code-block:: scolvoscript :caption: Example insertOrReplace() function call :linenos: var userQuery = insertOrReplace().from("note"); userQuery.set("id", "735cda84-330a-11ec-8d3d-0242ac130003"); userQuery.set("title", "New title"); userQuery.set("content", "New content"); userQuery.execute(); .. .. Note:: When executing insert-or-replace operation to the database it is simpler to use :ref:`insertOrReplaceTypeDefinition() built-in function`. .. index:: select() built-in function select() -------- This function is a chanining function, it creates a QueryBuilder object with **select** query type (SELECT database operation with support of JOIN, WHERE, GROUP BY, HAVING, ORDER BY and LIMIT). It is usually used when rows are selected from client database. *Function syntax* .. QueryBuilder select() .. code-block:: scolvoscript :caption: Example select() function call :linenos: var noteDaos = select() .from("note") .orderBy("title", "asc") .execute(); .. .. index:: selectDistinct() built-in function selectDistinct() ---------------- This function is a chanining function, it creates a QueryBuilder object with **select distinct** query type (SELECT DISTINCT database operation with support of JOIN, WHERE, GROUP BY, HAVING, ORDER BY and LIMIT). It is usually used when rows are selected from client database and we don't want to have column value combination repeated. *Function syntax* .. QueryBuilder selectDistinct() .. code-block:: scolvoscript :caption: Example selectDistinct() function call where we want to have the title list of notes :linenos: var noteDaos = selectDistinct() .selectAs("note.title", "title") .from("note") .orderBy("title", "asc") .execute(); .. .. index:: update() built-in function update() -------- This function is a chanining function, it creates a QueryBuilder object with **update** query type (UPDATE database operation). It is used when data has to be updated in the client database. *Function syntax* .. QueryBuilder update() .. code-block:: scolvoscript :caption: Example update() function call :linenos: var updateQuery = update().from("note"); updateQuery.set("title", "New title with change"); updateQuery.set("content", "Content change"); updateQuery.where(eq("id", "735cda84-330a-11ec-8d3d-0242ac130003")); updateQuery.execute(); .. .. Note:: When executing update operation to the database it is easier to use :ref:`updateTypeDefinition() built-in function`. .. index:: delete() built-in function delete() -------- This function is a chanining function, it creates a QueryBuilder object with **delete** query type (DELETE database operation). It is used when data has to be removed from the client database. *Function syntax* .. QueryBuilder delete() .. code-block:: scolvoscript :caption: Example delete() function call :linenos: var deleteQuery = delete().from("note"); deleteQuery.where(eq("id", "735cda84-330a-11ec-8d3d-0242ac130003")); deleteQuery.execute(); .. .. Note:: When executing delete operation it is easier to use :ref:`deleteTypeDefinition() built-in function`. .. index:: from() built-in function from() chaining function ------------------------ This function is a chanining function, it adds the *table* name to the QueryBuilder. *Function syntax* .. QueryBuilder .from(tableName or select defining a table) .. code-block:: scolvoscript :caption: Example from() function call :linenos: var deleteQuery = delete().from("note"); deleteQuery.where(eq("id", "735cda84-330a-11ec-8d3d-0242ac130003")); deleteQuery.execute(); .. .. index:: fromAs() built-in function fromAs() chaining function --------------------------- This function is a chanining function, it adds the *table* name with specific name (*as*) to the QueryBuilder. *Function syntax* .. QueryBuilder .fromAs(tableName or select defining a table, name in query) .. code-block:: scolvoscript :caption: Example fromAs() function call :linenos: var noteDaos = selectDistinct() .selectAs("noteTitles.title", "title") .fromAs("note", "noteTitles") .orderBy("title", "asc") .execute(); .. .. index:: select(columns) built-in function select(columns) chaining function ---------------------------------- This function is a chanining function, it adds columns to the column list of the QueryBuilder. *Function syntax* .. QueryBuilder .select() Where *columns* is one or more column name. .. code-block:: scolvoscript :caption: Example select(columns) function call :linenos: var noteDaos = select() .select("noteTitles.title", "noteTitles.content") .from("note") .orderBy("title", "asc") .execute(); .. .. index:: selectAs(column) built-in function selectAs(column) chaining function ---------------------------------- This function is a chanining function, it adds a column to the column list of the QueryBuilder. *Function syntax* .. QueryBuilder .selectAs(columnName) Or QueryBuilder .selectAs(columnName, aliasName) Where *column* is a String, and if aliasName is given, then the column is added with alias. .. code-block:: scolvoscript :caption: Example selectAs(column) function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .orderBy("noteName", "asc") .execute(); .. .. index:: table(tableName) built-in function table(tableName) function ------------------------- This function creates a Table oject with name and optionally with alias, the *toString()* function creates the "tableName" or "tableName alias" String. *Function syntax* .. Table table(tableName) Or Table table(tableName, alias) Where *tableName* is a String, and if aliasName is given, then Table is created with the given alias. .. code-block:: scolvoscript :caption: Example table() function call :linenos: var noteTable = table("note"); .. .. index:: and() built-in function and() function --------------- This function creates a logical AND criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria and(criterion ...) Where *Criterion* can be any criterion (e.g.: eq(), lt(), gt(), like(), between, custom(), etc. ...), and there can be two or more criterion defined. .. code-block:: scolvoscript :caption: Example and() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(and(eq("note.id", "1234"), like("note.title", "%my%"))) .orderBy("noteName", "asc") .execute(); .. .. index:: or() built-in function or() function --------------- This function creates a logical OR criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria or(criterion ...) Where *Criterion* can be any criterion (e.g.: eq(), lt(), gt(), like(), between, custom(), etc. ...), and there can be two or more criterion defined. .. code-block:: scolvoscript :caption: Example or() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(or(eq("note.id", "1234"), eq("note.id", "4321"))) .orderBy("noteName", "asc") .execute(); .. .. index:: not() built-in function not() function --------------- This function creates a logical NOT criteria with the given parameter what can be used in other QueryBuilder functions. *Function syntax* .. Criteria not(criteria) Where the given *Critera* can be any criteria (e.g.: eq(), lt(), gt(), like(), between, custom(), etc. ...). .. code-block:: scolvoscript :caption: Example not() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(not(eq("note.id", "1234"))) .orderBy("noteName", "asc") .execute(); .. .. index:: eq() built-in function eq() function --------------- This function creates an *equals* criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria eq(columnName, columnValue) Where the given *columnName* can be any String and columnValue is given as Object. The **null** columnValue is transformed to "NULL" literal. .. code-block:: scolvoscript :caption: Example eq() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(eq("note.id", "1234")) .orderBy("noteName", "asc") .execute(); .. .. index:: notEq() built-in function notEq() function ----------------- This function creates a *not equals* criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria notEq(columnName, columnValue) Where the given *columnName* can be any String and columnValue is given as Object. The **null** columnValue is transformed to "NULL" literal. .. code-block:: scolvoscript :caption: Example notEq() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(notEq("note.id", null)) .orderBy("noteName", "asc") .execute(); .. .. index:: gt() built-in function gt() function ----------------- This function creates a *greater than* ('>') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria gt(columnName, numberValue) Where the given *columnName* can be any String and *numberValue* is given as number. .. code-block:: scolvoscript :caption: Example gt() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(gt("note.createdAt", 1635843760000)) .orderBy("noteName", "asc") .execute(); .. .. index:: gEq() built-in function gEq() function ----------------- This function creates a *greater than or equals* ('>=') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria gEq(columnName, numberValue) Where the given *columnName* can be any String and *numberValue* is given as number. .. code-block:: scolvoscript :caption: Example gEq() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(gEq("note.createdAt", 1635843760000)) .orderBy("noteName", "asc") .execute(); .. .. index:: lt() built-in function lt() function ----------------- This function creates a *less than* ('<') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria lt(columnName, numberValue) Where the given *columnName* can be any String and *numberValue* is given as number. .. code-block:: scolvoscript :caption: Example lt() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(lt("note.createdAt", 1635843760000)) .orderBy("noteName", "asc") .execute(); .. .. index:: lEq() built-in function lEq() function ----------------- This function creates a *less than or equals* ('<=') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria lEq(columnName, numberValue) Where the given *columnName* can be any String and *numberValue* is given as number. .. code-block:: scolvoscript :caption: Example lEq() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(lEq("note.createdAt", 1635843760000)) .orderBy("noteName", "asc") .execute(); .. .. index:: like() built-in function like() function ----------------- This function creates a *like* ('LIKE') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria like(columnName, columnValue) Where the given *columnName* can be any String and *columnValue* is given as Object. .. code-block:: scolvoscript :caption: Example like() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(like("note.title", "%my%")) .orderBy("noteName", "asc") .execute(); .. .. index:: notLike() built-in function notLike() function ------------------- This function creates a *not like* ('NOT LIKE') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria notLike(columnName, columnValue) Where the given *columnName* can be any String and *columnValue* is given as Object. .. code-block:: scolvoscript :caption: Example notLike() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(notLike("note.title", "%excluded%")) .orderBy("noteName", "asc") .execute(); .. .. index:: in() built-in function in() function ------------------- This function creates an *in* ('IN') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria in(columnName, inValue) Where the given *columnName* can be any String and *inValue* is given as Object and later converted to String. .. code-block:: scolvoscript :caption: Example in() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(in("note.title", "('My title1', 'My title2')")) .orderBy("noteName", "asc") .execute(); .. .. index:: notIn() built-in function notIn() function ------------------- This function creates a *not in* ('NOT IN') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria notIn(columnName, inValue) Where the given *columnName* can be any String and *inValue* is given as Object and later converted to String. .. code-block:: scolvoscript :caption: Example notIn() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(notIn("note.title", "('excluded1', 'excluded2')")) .orderBy("noteName", "asc") .execute(); .. .. index:: between() built-in function between() function ------------------- This function creates a *between* ('BETWEEN') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria between(columnName, columnValue1, columnValue2) Where the given *columnName* can be any String and *columnValue1* and *columnValue2* are given as Objects. .. code-block:: scolvoscript :caption: Example between() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(between("note.createdAt", 1635843460000, 1635843760000)) .orderBy("noteName", "asc") .execute(); .. .. index:: notBetween() built-in function notBetween() function ---------------------- This function creates a *not between* ('NOT BETWEEN') criteria with the given parameters what can be used in other QueryBuilder functions. *Function syntax* .. Criteria notBetween(columnName, columnValue1, columnValue2) Where the given *columnName* can be any String and *columnValue1* and *columnValue2* are given as Objects. .. code-block:: scolvoscript :caption: Example notBetween() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(notBetween("note.createdAt", 1635843460000, 1635843760000)) .orderBy("noteName", "asc") .execute(); .. .. index:: custom() built-in function custom() function ---------------------- This function creates a custom criteria with the given parameter what can be used in other QueryBuilder functions. *Function syntax* .. Criteria custom(customExpression) Where the given *customExpression* is given as String. .. code-block:: scolvoscript :caption: Example notBetween() function call :linenos: var noteDaos = select() .selectAs("note.title", "noteName") .from("note") .where(custom("note.createdAt > 1635843460000 AND note.createdAt < 1635843760000")) .orderBy("noteName", "asc") .execute(); ..