Loading...
This chapter gives an overview of the members available per data type, e.g. a string. As explained in the topic"Object and Member Notation (dot syntax)", all kinds of objects can be addressed in the scripting language by using their members which set (or return if applicable) properties or methods of that object. Please refer to the chapter "Script Language" for more details about scripting in general.
Each data type in Widget Designer, String, Integer, Double, Boolean, Date, List, Color and JSON, has its own, specific members. Those Members can be used for conversion, editing and information. Members that return a result can even be used with further members.
Please note that these methods only return values, they do not change the object they refer to themselves. One exception here are some members of the color and JSON data types.
The data type of the return value is highlighted in the table below.
Example:
var x = "Hello World!"
var y = x.Contains("llo").ToInteger
DebugMessage(y)
The Debug Logger shows "1", as the Boolean value (true) returned by the Contains-member was additionally converted to an integer value (1). The variable "x" keeps its value "Hello World!".
Even object properties can be used like this:
"var x = Fader1.Value.Round(2)" assigns the value of Fader1, rounded to two digits, to the local variable "x".
Below, you can find all Boolean, Color, Date, Double, Integer, Json, List, Object and String members. As the members "Type" and "Locked" are available for all data types, they are mentioned as "Variable.Type" and Variable.Locked, respectively.
One special data type is JSON, it enables you to store large sets of data and edit and retrieve this information for other purposes. The "location" of a JSON element is the key (e.g. "arr"), or in case of nested maps the path expressed with a dot syntax (e.g."map.b"). If you are interested in the use of JSON objects, please refer to the chapter Using JSON.
The object data type is always applied when it is not possible to determine the specific type of an object beforehand, e.g. for list elements, local variables without a value assigned or for the return value of a function.
Boolean.Not |
Example: |
Returns the negated Boolean value of the object Bool |
Boolean.ToInteger |
Example: |
Returns an integer for the object value. "False" is converted to "0", "True" to "1" |
Boolean.ToString |
Example: |
Returns the value of the object Bool as a string |
Color.A |
Example: |
Returns the alpha value of the object color as an integer (0-255) |
Color.B |
Example: |
Returns the blue value of the object color as an integer (0-255) |
Color.G |
Example: |
Returns the green value of the object color as an integer (0-255) |
Color.R |
Example: |
Returns the red value of the object color as an integer (0-255) |
Color.SetRGB(red,green,blue) |
Example: Example2: |
Sets the RGB values of the object color. This way you can change the value of a color variable but also set the color properties of various objects e.g. widgets. Verbose Example: |
Color.SetRGBA(red,green,blue,alpha) |
Example: Example2: |
Sets the RGBA values of the object color. This way you can change the value of a color variable but also set the color properties of various objects e.g. widgets. Verbose Example: |
Color.ToHex |
Example: |
Returns the hexadecimal color value of the object color as a string |
Date.AddDays(days) |
Example: |
Returns the object date plus the indicated amount of days Verbose Example: |
Date.AddHours(hours) |
Example: |
Returns the object date plus the indicated amount of hours Verbose Example: |
Date.AddMilliseconds(milliseconds) |
Example: |
Returns the object date plus the indicated amount of milliseconds Verbose Example: |
Date.AddMinutes(minutes) |
Example: |
Returns the object date plus the indicated amount of minutes Verbose Example: |
Date.AddMonths(months) |
Example: |
Returns the object date plus the indicated amount of months Verbose Example: |
Date.AddSeconds(seconds) |
Example: |
Returns the object date plus the indicated amount of seconds Verbose Example: |
Date.AddYears(years) |
Example: |
Returns the object date plus the indicated amount of years Verbose Example: |
Date.Day |
Example: |
Returns the object date's days as an integer |
Date.DayOfWeek |
Example: |
Returns the weekday of the object's date information as an integer |
Date.DayOfYear |
Example: |
Returns the days of the year of the object's date information as an integer |
Date.DiffDays(date) |
Example: |
Returns the amount of days of difference between the object date and the indicated date as integer Verbose Example: |
Date.DiffHours(date) |
Example: |
Returns the amount of hours of difference between the object date and the indicated date as an integer Verbose Example: |
Date.DiffMilliseconds(date) |
Example: |
Returns the amount of milliseconds of difference between the object date and the indicated date as an integer Verbose Example: |
Date.DiffMinutes(date) |
Example: |
Returns the amount of minutes of difference between the object date and the indicated date as an integer Verbose Example: |
Date.DiffSeconds(date) |
Example: |
Returns the amount of seconds of difference between the object date and the indicated date as an integer Verbose Example: |
Date.Format(format string) |
Example: |
Uses the C# method "String.Format" on the object date and returns the formatted string. For further examples and possible "format strings", please visit https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings |
Date.Hour |
Example: |
Returns the object date's hours as an integer |
Date.Millisecond |
Example: |
Returns the object date's milliseconds as an integer |
Date.Minute |
Example: |
Returns the object date's minutes as an integer |
Date.Month |
Example: |
Returns the object date's months as an integer |
Date.Second |
Example: |
Returns the object date's seconds as an integer |
Date.ToString |
Example: |
Returns the value of the object date as a string Note: Use "Date.Format(format string)" to return a formatted date as a string value. |
Date.Year |
Example: |
Returns the object date's years as an integer |
Double.Ceiling |
Example: |
Returns the rounded up value (to a whole number) of the object double as integer value |
Double.Floor |
Example: |
Returns the rounded down value (to a whole number) of the object double as integer value |
Double.Round(digits) |
Example: |
Returns the value of the double object, rounded to the indicated number of decimals. |
Double.ToInteger |
Example: |
Returns the value of the object double as an integer (and rounds the value to a whole number) |
Double.ToString(format string[optional]) |
Example: |
Returns the value of the object double as a string. When using the optional parameter "Format string", the c# method string.format is used and returns a formatted string. For further information on String.Format, please visit https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx#Format_Custom and https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings |
Integer.ToString(format string[optional]) |
Example: |
Returns the value of the object integer as a string. When using the optional parameter "Format string", the c# method string.format is used and returns a formatted string. For further information on String.Format, please visit https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx#Format_Custom and https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings |
Json.Add(array location,value) |
Example: |
Adds a new item to an array at the specified location and returns the changed JSON array (optional) Verbose Example: |
Json.Clear(map location) |
Example: |
Removes all child items at the specified location and returns the JSON element containing the changed item (optional) Verbose Example: |
Json.Copy |
Example: |
Returns a copy of the JSON object. Verbose Example: |
Json.Count(array or map location) |
Example: |
Returns the number of child items at the specified location as an integer value. If the location is not a map or an array, an exception is thrown Verbose Example: |
Json.Get(location) |
Example: |
Returns the value at specified location as a JSON expression Verbose Example: |
Json.GetDate(location) |
Example: |
Returns the value at the specified location as a date value. If the value cannot be converted, a default value is returned Verbose Example: |
Json.GetDouble(location) |
Example: |
Returns the value at the specified location as a double value. If the value cannot be converted, a default value is returned Verbose Example: |
Json.GetInteger(location) |
Example: |
Returns the value at the specified location as an integer value. If the value cannot be converted, a default value is returned Verbose Example: |
Json.GetList(location) |
Example: |
Returns the value at the specified location as a list value. If the value cannot be converted, a default value is returned Verbose Example: |
Json.GetString(location) |
Example: |
Returns the value at the specified location as a string value. Verbose Example: |
Json.Keys(optional array or map location) |
Example: |
Returns a list of all keys/indices at the specified location Verbose Example: |
Json.Remove(location) |
Example: |
Removes the selected location as well as all of its child elements. Verbose Example: |
Json.Set(location, value) |
Example: |
Changes the value or defines a new one at the specified location and returns the JSON element containing the changed item (optional) Verbose Example: |
Json.ToFile(filePath) |
Example: |
Writes the JSON data, formatted as pretty string, into a text file located at the specified path. If the file does not exist, a new file is automatically created. Verbose Example: |
Json.ToPrettyString |
Example: |
Returns a string with the JSON data formatted with line breaks and indented for better readability. Verbose Example: |
Json.ToString |
Example: |
Returns the JSON object as a string Verbose Example: |
Json.Values(array or map location) |
Example: |
Returns a list of all values at the specified location Verbose Example: |
List.Avg |
Example: |
Returns the average value of all list items as double. |
List.Copy |
Example: |
Returns a copy of the list object. Verbose Example: |
List.Count |
Example: |
Returns an integer with the number of elements of the list object. Verbose Example: |
List.DecodeBytes |
Example: |
Returns a string decoded from the UTF-8 byte values of each element of the list object. The integers in the list have to range from 0 to 255. Please also refer to the string member ".EncodeBytes" Verbose Example: |
List.Distinct |
Example: |
Removes duplicate elements from the list and returns the resulting list. Verbose Example: |
List.IndexOf(search expression) |
Example: |
Searches for the indicated search expression and returns its index as an integer value. If the expression is contained more than once, the index if the first one is returned, if the expression is not included at all, "-1" is returned |
List.Join(separator) |
Example: |
Concatenates all items of the list object, separated by the specified separator string, and returns this value as a single string |
List.Max |
Example: |
Searches the list object for the item with the highest value and returns this as an integer value. Only applicable for lists containing solely integer values |
List.Min |
Example: |
Searches the list object for the item with the lowest value and returns this as an integer value. Only applicable for lists containing solely integer values |
List.Remove(index) |
Example: |
Removes the element with the specified index from the original list and returns a Boolean value indicating if the removal was successful. Verbose Example: |
List.Sort(Boolean expression) |
Example: |
Sorts the list object according to increasing (true) or decreasing (false) values, where the Boolean expression differs between the two methods and returns the sorted list Verbose Example: |
List.WhereRegex(search expression) |
Example: |
Returns a list of all items of the list object where the search expression is included. This method is compatible to RegEx (regular expressions). For further information on RegEx, please visit: https://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx Verbose Example: |
Object.ToBoolean |
Example: |
Returns the object content formatted to a Boolean type object if the characters form: 0,1,true,false |
Object.ToColor |
Example: |
Returns the object string formatted to a color type object, the object string has to be a six-digit hexadecimal value |
Object.ToDate |
Example: |
Returns the object content formatted to a date type object |
Object.ToDouble |
Example: |
Returns the value of the object content in double format if the characters form a real number |
Object.ToInteger |
Example: |
Returns the value of the object content in integer format if the characters form a real whole number |
Object.ToJson |
Example: |
Returns the value of the object content in JSON format if the syntax applies to the respective rules for JSON objects Verbose Example: |
Object.ToList |
Example: |
Returns the object content formatted to a list type object |
Object.ToString |
Example: |
Returns the object content formatted to a string type object |
String.Contains(search expression) |
Example: |
Returns a Boolean value, indicating if the search expression is included in the object string |
String.EncodeBytes |
Example: |
Returns a list containing the UTF-8 byte value of each character as integer |
String.EndsWith(search expression) |
Example: |
Returns a Boolean value, indicating if the object string ends with the search expression |
String.Format(Arbitrary Values[Optional]) |
Example: |
Uses the C# method "String.Format" on the object string and returns the formatted string. For further information on String.Format, please visit https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx#Format_Custom or http://timtrott.co.uk/string-formatting-examples/ Verbose Example: |
String.IsEmpty |
Example: |
Returns a Boolean value, indicating if the object string contains a value or is empty. Verbose Example: |
String.IsMatch(search expression) |
Example: |
Returns a Boolean value, indicating if the search expression is included in the object string. This method is compatible to RegEx (regular expressions). For further information on RegEx, please visit: https://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx or http://timtrott.co.uk/string-formatting-examples/ Verbose Example: |
String.IsNumeric |
Example: |
Returns a Boolean value, indicating if the object string contains a single numeric value. This member is particularly useful for checking a string value before converting it to an integer or double with ".ToInteger" or "ToDouble". |
String.Left(characters) |
Example: |
Separates the object string at the indicated number of characters (starting at the beginning) and returns all characters of the left split string as a string value |
String.Length |
Example: |
Returns an integer with the length of the string object |
String.PadLeft(total length, padding character (optional)) |
Example: |
Pads the object string with white spaces (or the optional padding character) in front of the expression, until the total length of characters is achieved and returns the respective string |
String.PadRight(total length, padding character (optional)) |
Example: |
Pads the object string with white spaces (or the optional padding character) behind the expression, until the total length of characters is achieved and returns the respective string |
String.Replace(search string, replacement) |
Example: |
Searches the object string for the indicated string and replaces all found strings with the secondly indicated one, the result is also returned as string value |
String.Right(characters) |
Example: |
Separates the object string at the indicated number of characters (starting at the end) and returns all characters of the right split string as a string value |
String.Split(separator) |
Example: |
Splits the object string indicated by the separator and returns a list of all sub strings |
String.StartsWith(search expression) |
Example: |
Returns a Boolean value, indicating if the object string starts with the search expression |
String.SubString(start, length) |
Example: |
Returns a sub string of the object string that starts at the indicated index (first character has index 0) and has the indicated length |
String.ToCamelCase |
Example: |
Returns the object string formatted to a CamelCase expression |
String.ToCharArray |
Example: |
Returns a list where each character of the source string is an individual list element |
String.ToColor |
Example: |
Returns the object string formatted to a color type object, the object string has to be a six-digit hexadecimal value |
String.ToDate |
Example: |
Returns the object string formatted to a date type object |
String.ToDouble |
Example: |
Returns the value of the object string in double format if the characters form a real number |
String.ToInteger |
Example: |
Returns the value of the object string in integer format if the characters form a real whole number |
String.ToJson |
Example: |
Returns the value of the object string in JSON format if the syntax applies to the respective rules for JSON objects Verbose Example: |
String.ToLower |
Example: |
Returns the the object string, formatted with only lower case letters. |
String.ToSnakeCase |
Example: |
Returns the object string formatted to a Snake Case expression |
String.ToUpper |
Example: |
Returns the the object string, formatted with only upper case letters. |
String.Trim |
Example: |
Returns the object string without any white spaces at the end or the beginning |
String.TrimEnd |
Example: |
Returns the object string without any white spaces at the end |
String.TrimStart |
Example: |
Returns the object string without any white spaces at the beginning |
String.Unescape |
Example: |
Returns the object string with the correct formatting concerning "\n" (new line), "\r" (carriage return) and "\t" (tab). Without unescaping these expressions, they are handled as simple characters. |
Variable.Locked |
Example: |
Returns a Boolean value, indicating if the object is locked. |
Variable.Type |
Example: |
Returns the type of the respective object as a string value. Possible results are: Boolean, Color, Date, Double, Integer, Json, List, Object and String |