Flow Connect Help
Roadmap
  • ℹ️This is Flow Connect
    • Overview
    • Technical overview
      • System requirements
    • What's new?
      • Change log
  • ▶️quick start
    • Create an application
    • Create an admin access group
  • 🔁working with Connect
    • Connect to systems
      • Connector agents
        • Add agent group
        • Install agent manager
        • Add agent
        • Manage agent
      • Connectors
        • IFS Applications 10
        • Oracle
        • Microsoft SQL Server
        • Send Email
        • REST
          • Microsoft Graph API
          • Infor M3 REST
            • Obtaining Infor ION API file
            • Configure REST Connector with ION API file
          • IFS Cloud
            • IAM Client Registration
            • Obtaining end-point info from IFS Cloud
            • Configure REST Connector for IFS Cloud
      • Redirect URIs
    • Create and design
      • Application packages
      • Applications
        • Create
        • Design
        • Test
        • Commit
      • Portal Pages
        • Create Portal Page
        • Design Portal Page
        • Commit Portal Page
      • Components
        • Create component
        • Manage component
      • Modules
        • Create module
        • Manage module
      • Automations
        • Functionality
        • Create Automation
        • Manage Automation
        • Creating Access Key
        • Executing Automations Externally
          • IFS Cloud
          • Salesforce Apex Trigger Example
    • Deploy
      • Environments
      • Deploy
    • Use
      • On mobile devices
      • In web browser - Web client
      • In web browser - Portal
    • Share
      • Share Applications
    • User administration
      • Users
        • Invite a new user
        • Manage users
      • User groups
        • Create user groups
        • Manage user groups
      • Access
        • Manage access
  • ⏸️Reference
    • How-to guides
      • Create User Step controls
        • Header
        • Static text
        • Labelled static text
        • Link
        • Image viewer
        • Text input
        • Numeric input
        • Date input
        • Time input
        • Check box input
        • Binary option input
        • List selection input
        • List multi-selection input
        • Menu selection input
        • Data grid
        • Calendar control
        • Image selection input
        • List presentation
        • Camera Input
      • Dependent controls in User step
        • Variable source
        • Expression source
        • Control visibility (condition to hide)
      • Configure SSO for Microsoft Entra
    • Reference
      • Clients
        • Settings
        • My data
      • Designer
        • Controls
          • Header
          • Static text
          • Labeled static text
          • Link
          • External app launcher
          • Image viewer
          • Text input
          • Numeric input
          • Date input
          • Time input
          • Check box input
          • Binary option input
          • List selection input
          • List multi-selection input
          • Menu selection input
          • Data grid
          • Calendar
          • Image selection input
          • List presentation
          • Camera input
          • File gallery
          • GPS location input
          • Signature capture input
          • Item creation sub task
          • Check list sub task
          • Verb sub task
        • Steps
          • Start
          • User interaction
          • External system
          • Decision
          • Assertion
          • HTTP requests
          • Assignment
          • Table
          • Event listener
          • Checkpoint
          • Script
          • Annotation
          • End
          • Local data resource
      • Portal
        • Design items
          • Portlets
            • Accumulation chart
            • Base chart
            • Circular gauge
            • Custom content
            • Data tree
            • Document viewer
            • Filter
            • Kanban
            • KPI card
            • Link
            • My apps
            • Record
            • Rich text
            • Table
          • Container
          • Common portlet configuration
            • General
            • Events
            • Data
            • Custom buttons
            • Style
        • Portal settings
          • Branding
          • Page
          • Navigation
        • Profile
        • Portlet actions
        • Cache
        • Input to Start Step
      • Diagnostic mode
      • FlowScript
        • Walkthrough
          • Introduction
          • Expressions and programs
          • Anatomy of a program
          • Variables
          • Simple types
          • Nullable types
          • Records
          • Sequences
          • Other types
          • Arithmetic
          • Other expressions
          • Queries
          • Conditionals and loops
          • Function definitions
          • Built-in functions
          • DateTime module
          • Seq module
          • HTTP module
          • CSV module
          • JSON module
          • Trace module
          • Record module
          • XML Module
          • Custom modules
          • Custom Types
          • Appendix: Subtyping rules
          • Appendix: Escape sequences
          • Appendix: Type checking errors
      • Flowscript Copilot
      • Glossary
    • Flow Connect Downloads
      • Install Flow Connect Designer
    • Migrate from Flow Classic
      • Portal - migrate from Flow Classic
      • Classic vs. Connect Comparison Guide
Powered by GitBook
On this page
  • Text-related functions
  • isNumber
  • upper
  • lower
  • val
  • len
  • urlEncode
  • urlDecode
  • chr
  • left
  • right
  • mid
  • regexMatch
  • regexMatches
  • regexReplace
  • replace
  • trim
  • inStr
  • guid
  • str
  • rgb
  • split
  • splitToTable
  • join
  • format
  • formatLocale
  • Binary-related functions
  • encodeText
  • decodeText
  • base64Encode
  • base64Decode
  • Null-related functions
  • isNull
  • isNullOrEmpty
  • Number-related functions
  • ceil
  • floor
  • random
  • max
  • min
  • pow
  • round
  • sum
  • Date-related functions
  • now
  • date
  • toDate
  • Sequence-related functions
  • any
  • count
  • first
  • firstOrDefault
  • firstOrNull
  • last
  • lastOrDefault
  • lastOrNull
  • range
  • take
  • skip
  • eval
  • flatten
  • empty
  • Miscellaneous
  • hash
  • identity
  • sleep

Was this helpful?

  1. Reference
  2. Reference
  3. FlowScript
  4. Walkthrough

Built-in functions

This page describes the built-in functions of the Flow Connect platform. Note that additional functions are available in the built-in modules (described in subsequent chapters of this document).

PreviousFunction definitionsNextDateTime module

Last updated 19 days ago

Was this helpful?

Text-related functions

isNumber

Signature: isNumber(input: primitive) -> boolean

Returns a boolean value indicating whether the input argument can be converted into a number by the function.

// x will have the value true
let x = isNumber("1.5");

// y will have the value false
let y = isNumber("hello");

upper

Signature: upper(self input: text) -> text

Returns an uppercase version of the input argument.

return upper("Hello"); // returns "HELLO"

lower

Signature: lower(self input: text) -> text

Returns an lowercase version of the input argument.

return lower("Hello"); // returns "hello"

val

Signature: val(input: text) -> number

The val function will interpret either point or comma as a decimal separator.

// x will have the numeric value 1.5
let x = val("1.5"); 

// y will have the numeric value 3.2
let y = val("3,2"); 

// ERROR: The value of type text could not be converted to number.
let z = val("hello");

len

Signature: len(self input: text) -> number

Returns the number of characters in the input argument.

returns len("Hello"); // returns 5

urlEncode

Signature: urlEncode(self input: text) -> text

// returns "https%3a%2f%2fwww.novacura.com"
return URLEncode("https://www.novacura.com")

urlDecode

Signature: urlDecode(self input: text) -> text

return "https%3a%2f%2fwww.novacura.com".urlDecode() 
// returns https://www.novacura.com

chr

Signature: chr(input: primitive) -> text

Converts a unicode code point (in decimal format) to the corresponding text value. Inputs must be in the Basic Multilingual Plane of Unicode, otherwise the function will raise an error.

let tabCharacter = chr(9); // the tab character
let blackPointingUpTriangle = chr(9650); // "▲" 

left

Signature: left(self input: text, count: number) -> text

Returns a specified number of characters taken from the input text, starting from the left. If the number of characters specified by the count argument exceeds the number of characters in the input, the whole of input will be returned. If count is zero or less then an empty text will be returned.

let oneFromTheLeft = left("hello", 1) // oneFromTheLeft == "h"
let largerThanInput = left("hello", 100) // largerThanInput = "hello" 
let zeroFromLeft = "hello".left(0) // zeroFromLeft == ""

right

Signature: right(self input: text, count: number) -> text

Returns a specified number of characters taken from the input text, starting from the right. If the number of characters specified by the count argument exceeds the number of characters in the input, the whole of input will be returned. If the count is zero or less then an empty text will be returned.

let threeFromRight = right("hello", 3) // threeFromRight == "llo"
let largerThanInput = "hello".right(500) // largerThanInput = "hello" 
let zeroFromRight = right("hello", 0) // zeroFromRight == ""

mid

Signature: mid(self input: text, index: number, count: number) -> text

Returns a specified number of characters taken from the input text, starting at the position indicated by the indexargument.

If the numbers of the characters specified by the count argument exceeds the remaining characters after the index, the rest of the text will be returned.

The function will throw an error if the given start index is greater than or equal to the number of characters in the input.

return "hello".mid(1,3) // will return "ell"

regexMatch

Signature: regexMatch(input: text, pattern: text) -> boolean

let contains3LetterWord = regexMatch("abc", @"\w{3}") // true
let contains3Digits = regexMatch("abc", @"\d{3}") //  false

regexMatches

Signature: regexMatches(input: text, pattern: text) -> text*

let twoDigits = regexMatches("123 45", @"\d{2}") // twoDigits == ["12", "45"]
let fourDigits = regexMatches("123 45", @"\d{4}") // fourDigits == []

regexReplace

Signature: regexReplace(self input: text, pattern: text, replacement: text ) -> text

let digitsAsX = regexReplace("2hello1", @"\d", "x") // digitsAsX == "xhellox"
let noDigits = "2hello1".regexReplace(@"\d", "") // noDigits == "hello"

replace

Signature: replace(self input: text, search: text, replacement: text ) -> text

Returns a value in which all occurrences of searchin input are replaced with replacement.

return Replace("one two three", "three", "four") // returns "one two four"

trim

Signature: trim(self input: text) -> text

Returns the input text with trailing and leading whitespace removed.

return "   hello space ".trim() // returns "hello space"

inStr

Signature: inStr(self source: text, lookFor: text) -> number

Returns the index of the first occurrence of the lookFor argument in the source text. If no occurrence exists inside the source text, the function returns -1.

return inStr("hello world!", "w") // returns 6

guid

Signature: guid() -> text

return guid();

str

Signature: str(input: any) -> text

Returns a text representation of the input. Null values will be converted to a empty text value.

let example1 = str({name: "bob", id: 33}); // "{name: 'bob', id: 33}"
let example2 = str([1,2,3]); // "[1, 2, 3]"
let example3 = str(2 * 3); // "6"

rgb

Signature: rgb(red: number, green: number, blue: number) -> text

Returns the hex code corresponding the RGB color with given values of red, green and blue. The arguments will be rounded to the nearest integer in the range of 0 through 255.

return rgb(255, 255, 255); // will return #FFFFFF 

split

Signature: split(self input: text, delimiter: text ) -> text*

Returns all sub strings of the input argument, separated by the specified delimiter.If the given delimiter is not present in the input text then a sequence consisting only of the input text will be returned.

The delimiter argument must be exactly one character long.

return "1/2/3".split('/') // returns ["1", "2", "3"]

splitToTable

Signature: splitToTable(self input: text, delimiter: text ) -> {value: text}*

A version of the split function designed for compatiblity with Flow Classic.

return "1/2".splitToTable('/') // returns [{value: "1"}, {value: "2"}]

join

Signature: join(self sequence: primitive*, separator: text ) -> text

Concatenates all the text values in the sequence argument and returns a single text, inserting the separator between each element.

return ["a","b","c","d"].join(" ") // returns "a b c d"
return [1,2,3,4].join(",") // returns "1,2,3,4"

format

Signature: format(input: primitive, pattern: text) -> text

Returns a formatted text representation of a given number or datetime input using the given pattern to format it.

For numbers

return format(0.5, 'p') // will return "50%"

For dates

let d = date("2024-02-08T14:12:34.6821542+01:00");
return format(d, "yyyy-mm-dd") // will return "2024-02-08"

formatLocale

Signature: formatLocale(input: primitive, pattern: text, locale: text) -> text

Returns a formatted text representation of a given number or datetime input using the given pattern and locale to format it.

For numbers

return formatLocale(1000, 'C', 'en-US') // will return "$1,000.00"

For dates

let d = date("2024-02-08T14:12:34.6821542+01:00");
return formatLocale(d, "yyyy-mm-dddd", "fr-FR")  // will return "2024-04-jeudi" 

Binary-related functions

encodeText

Signature: encodeText(self input: text, encoding: text) -> binary

Encodes the input text to binary value with the given encoding. Valid values for the encoding parameter are: iso-8859-1, utf-8, utf-16 and utf-32.

return encodeText('åäö', 'iso-8859-1')

decodeText

Signature: decodeText(self data: binary, encoding: text) -> binary

Converts a binary value into a text representation using the provided encoding. Valid values for the encoding parameter are: iso-8859-1, utf-8, utf-16 and utf-32.

let result = encodeText('åäö', 'iso-8859-1');
return decodeText(result, 'iso-8859-1') // returns "åäö"

base64Encode

Signature: base64Encode(self data: binary) -> text

let result = base64Decode("hello world"):
return base64Encode(result) // returns "hello world"

base64Decode

Signature: base64Decode(self base64: text) -> binary

Converts a base64 encoded text into a binary file.

return decodeText(base64Decode('aGFsbMOlIHbDpHJsZGVu'), 'utf-8') 
// returns "hallå världen"

Null-related functions

isNull

Signature: isNull<T>(value: T?, replacement: T) -> T

Returns value if is not null, otherwise returns the replacement argument.

let nbrOrFive = isNull(3, 5) // nbrOrFive == 3

let test: text? = null;
let testOrHello = isNull(test, "hello") // testOrHello == "hello" 

isNullOrEmpty

Signature: isNullOrEmpty(value: text?, replacement: text) -> text

Returns value if it is not equal to null or the empty string (""); otherwise returns the replacement argument.

let x = isNullOrEmpty("", "hello"); // x == "hello"
let y = isNullOrEmpty("hello", "goodbye"); // y == "hello"
let z = isNullOrEmpty(null, "hi"); // z == 'hi'

Number-related functions

ceil

Signature: ceil(input: number) -> number

Rounds input argument upward to the nearest integer.

let positiveResult = ceil(5.5) // positiveResult == 6
let negativeResult = ceil(-5.5) // negativeResult == -5

floor

Signature: floor(input: number) -> number

Rounds inputdownward to the nearest integer.

let positiveResult = floor(5.5) // positiveResult == 5
let negativeResult = floor(-5.5) // negativeResult == -6

random

Signature: random(min: number, max:number) -> number

Generates a pseudo-random number between min and max.

return random(0,5) // result will be a number between 0 to 5

max

Signature: max(a: number, b:number) -> number

Returns the greatest of a and b.

let result = max(2,3) // result == 3

min

Signature: min(a: number, b:number) -> number

Returns the least or a and b.

let result = max(2,3) // result == 2

pow

Signature: pow(base: number, exponent: number) -> number

Returns the base raised to the exponent.

return pow(2,3) // returns 8

round

Signature: round(x: number) -> number

Returns x rounded to the nearest integer.

return round(1.2) // returns 1

sum

Signature: sum(sequence: number?*) -> number

Returns the sum of the numbers in a sequence. Returns 0 if the sequence is empty. Null values count as zero.

return sum([1, 2, 3, null, 4, 5]) // returns 15

Date-related functions

now

Signature: now() -> datetime

Returns a datetime value containing the calendar date and time indicated by the system clock of device on which the FlowScript is running.

let currentDateAndTime = now();

date

Signature: date(input: text) -> datetime

Converts the input argument to a datetime if possible. If the input cannot be converted to a date, the function raises an error.

The date function supports several different date and time formats such as YYYY-MM-DD, ISO 8601 and more.

let d = date("2024-02-08T14:12:34.6821542+01:00");

toDate

Signature: toDate(input: text, format: text) -> datetime

Converts the input argument to a datetime with the given format if possible. if the input cannot be converted to a date using the specified format, the function raises an error.

let yearMonthDay = ToDate('2021-03-10', 'yyyy-MM-dd')
let monthDayYear = ToDate('03/10/2021', 'MM/dd/yyyy')

// Here both yearMonthDay and monthDayYear will return the same date which
// will be the 10th of mars 2021 

Sequence-related functions

any

Signature: any(self sequence: unknown*) -> boolean

Returns a boolean value indicating whether the sequence has at least one element.

let someItems = [1, 2];
let noItems = [];

let a1 = any(someItems); // true
let a2 = noItems.any(); // false

count

Signature: count(self sequence: unknown*) -> number

Returns the number of items in a sequence.

let xs = [1, 2, 3];

let c1 = count(xs);
let c2 = xs.count();

first

Signature: first<T>(self sequence: T*) -> T

Returns the first element from the sequence, or raises an error if the sequence is empty.

let xs = [1, 2];
return xs.first(); // returns 1

firstOrDefault

Signature: firstOrDefault<T>(self sequence: T*, defaultValue: T) -> T

Returns the first element from the sequence. If the seauence is empty, the function returns the defaultValue argument.

let xs = case when random(0, 1) > 0.5
              then []
              else [1, 2, 3]
              end;

return xs.firstOrDefault(0)

firstOrNull

Signature: firstOrNull<T>(self sequence: T*) -> T?

Returns the first element from the sequence. If the seauence is empty, the function returns null.

return [1,2,3].firstOrNull() // will return 1
return firstOrNull([]) // will return null

last

Signature: last<T>(self sequence: T*) -> T

Returns the last element from the sequence, or raises an error if the sequence is empty.

return [1,2,3].last() // will return 3

lastOrDefault

Signature: lastOrDefault<T>(self sequence: T*, default: T ) -> T

Returns the last element from the sequence, or the default argument if the sequence is empty.

return [].lastOrDefault(22) // will return 22

lastOrNull

Signature: lastOrNull<T>(self sequence: T*, default: T ) -> T?

Returns the last element from the sequence, or null if the sequence is empty.

return [].lastOrNull() // return null

range

Signature: range(start: number, count: number) -> number*

Returns a sequence of countintegers beginning with start.

return range(5,3) // return [5,6,7]

take

Signature: take<T>(self sequence: T*, count: number ) -> T*

Returns the first N elements of the sequence.

return [1,2,3,4,5,6].take(3) // returns [1,2,3]

skip

Signature: skip<T>(self sequence: T*, count: number ) -> T*

Returns a sequence where the first N elements are skipped.

return [1,2,3,4,5,6].skip(3) // returns [4,5,6]

eval

Signature: eval<T>(self sequence: T*) -> T*

let nbrs = select random(0, 10) as r from range(0, 10);

let nbrsFiltered = nbrs where r != 2;
let nbrsFilteredOnceMore = nbrs where r != 2;

return nbrsFiltered == nbrsFilteredOnceMore // will likely return false
let nbrs = eval(select random(0, 10) as r from range(0, 10));

let nbrsFiltered = nbrs where r != 2;
let nbrsFilteredOnceMore = nbrs where r != 2;

return nbrsFiltered == nbrsFilteredOnceMore // will always return true

flatten

Signature: flatten<T>(self sequence: T**) -> T*

Flattens a sequence-of-sequences into a single sequence.

return [[1,2,3],[4,5,6],[7,8,9]].flatten() // returns [1,2,3,4,5,6,7,8,9]

empty

Signature: empty<T>(self sequence: T*) -> T*

Returns an empty sequence with the same type as the given argument. This function only exists for reasons of Flow Classic compatiblity.

return [1, 2, 3, 4].empty() // returns []

Miscellaneous

hash

Signature: hash(value: any) -> number

Returns a numeric hash of the value.

return hash([1, 2, 3, 4]) // will return 1644472305

identity

Signature: identity<T>(x: T) -> T

Returns the x argument. If the type argument is explicitly written out, the function can be used to "upcast" values to the primitive type.

return identity<primitive>(1) // will return 1 as a primtive value

sleep

Signature: sleep(minMilliseconds: number, maxMilliseconds: number) -> number

Pauses script execution for a randomly chosen number of milliseconds between minMillisecondsand maxMilliseconds.

return sleep(10000, 10000) // will return 10000 and pause the execution for 1 sec

Converts the input argument to a number if possible. If the input cannot be meaningfully converted to a number, the function raises a runtime error. To preempt such errors, you can use the function.

Returns the input argument in .

Converts the input argument from into regular text.

Returns a boolean value indicating whether if the given pattern can be match in the input text.

Returns a sequence of matches, if any, for the pattern in the input text.

Replaces the matches of the given pattern with the replacement argument in the input text. If nothing in the input matches the pattern, the original input will be returned.

Creates a non-empty UUID as described in .

Valid pattern argument for numbers are the same as standard format specifiers provided by to format numbers for decimal values.

Valid pattern argument for numbers are the same as standard format specifiers provided by to format dates.

The locale argument corresponds to a langue code as described in . If the locale argument is the empty text, the formatLocale function works the same as the format function.

Valid pattern argument for numbers are the same as standard format specifiers provided by to format numbers.

Valid pattern argument for numbers are the same as standard format specifiers provided by to format dates.

Converts a binary value into its text representation.

See also the

See also the .

Materializes a lazy sequence. See also

⏸️
URL Encoding
URL Encoding
Regular Expression
Regular Expression
Regular Expression
RFC 4122, Sec. 4.4
.NET
.NET
BCP 47
.NET
.NET
Base 64
DateTime module.
Seq module
val
isNumber
A note on laziness.