githubEdit

Utility Functions

Built-in functions for string processing, math, date operations, regex, and data types.

Source: module/script/helper/script_processor.py:get_allowed_functions_list()


String Functions

Type Conversion

str(value)       # Convert to string
int(value)       # Convert to integer
float(value)     # Convert to float
str_to_bool(s)   # "true"/"1"/"yes" → True, everything else → False

String Methods

lower(s)              # str.lower — "ABC" → "abc"
upper(s)              # str.upper — "abc" → "ABC"
split(s, sep)         # str.split — "a,b,c".split(",") → ["a","b","c"]
strip(s)              # str.strip — " abc " → "abc"
startswith(s, prefix) # str.startswith
endswith(s, suffix)   # str.endswith
circle-info

These are available as standalone functions but can also be called as methods on strings:

# Both work:
result = upper("hello")      # → "HELLO"
result = "hello".upper()     # → "HELLO"

Fuzzy String Matching

levenshtein_distance()

Calculates the edit distance between two strings (number of changes needed).

Example:

jaro_winkler_similarity()

Calculates a similarity score between 0.0 and 1.0.

Example:

circle-check

Regex Functions

Based on Python's re module, but available as standalone functions.

Searches for the first occurrence of a pattern.

Returns: Match object or None

Example — Extract order number from fulltext:

re_sub()

Replaces pattern matches with a replacement string.

Example — Remove special characters from invoice ID:

re_findall()

Finds all occurrences of a pattern.

Example — Find all PO numbers in document:


Date/Time Functions

datetime_today()

Returns today's date as a datetime object.

datetime_date

The date class for date creation.

strptime()

Parses a date string into a datetime object.

Example — Parse and use invoice date:

strftime()

Formats a datetime object as a string.

Example — Set processing date:

fromisocalendar()

Creates a date from ISO calendar week.

Example — Convert calendar week to date:

circle-check

calendar_monthrange()

Returns the weekday of the 1st and number of days in a month.

Example:


Decimal/Locale Functions

parse_decimal()

Parses a string to a decimal number with locale detection.

Example:

format_decimal_to_locale()

Formats a decimal number according to locale.

Example:


Math Functions

The full math module is available:

Function
Description

abs(x)

Absolute value

round(x, n)

Round to n decimal places

floor(x)

Floor (round down)

ceil(x)

Ceiling (round up)

sqrt(x)

Square root

pow(x, y)

Power

log(x) / log10(x)

Logarithm

pi

π (3.14159...)

e

Euler's number (2.71828...)

sin, cos, tan

Trigonometry

acos, asin, atan

Inverse trigonometry

degrees, radians

Degrees ↔ Radians

exp, fabs, fmod

Additional math functions

hypot, ldexp, frexp

Special calculations

modf

Separate integer/decimal parts


Data Structure Functions

circle-exclamation

Last updated

Was this helpful?