UltipaDocs
Try Playground
  • Introduction
  • GQL vs Other Languages
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Shortest Paths
    • Graph Patterns
    • Overview
    • Closed Graph
    • Open Graph
    • Graph Sharding and Storage
    • Constraints
    • Unique Identifiers
    • INSERT
    • INSERT OVERWRITE
    • UPSERT
    • SET
    • REMOVE
    • DELETE
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Scalar Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Type Conversion Functions
    • Table Functions
    • AI & Vector Functions
    • Database Functions
  • Operators
  • Predicates
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
  • Transactions
  • Triggers
  • Query Management
  • Backup and Restore
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Syntactic Notation
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Functions

Type Conversion Functions

Overview

Type conversion functions convert values between different data types.

TOINTEGER()

Converts a value to an integer.

Syntax:

TOINTEGER(value) -> int

Example:

GQL
RETURN TOINTEGER('42') AS str_to_int,
       TOINTEGER(3.7) AS float_to_int

Result:

str_to_intfloat_to_int
423

TOFLOAT()

Converts a value to a float.

Syntax:

TOFLOAT(value) -> float

Example:

GQL
RETURN TOFLOAT('3.14') AS str_to_float,
       TOFLOAT(42) AS int_to_float

Result:

str_to_floatint_to_float
3.1442.0

TOSTRING()

Converts a value to a string.

Syntax:

TOSTRING(value) -> string

Example:

GQL
RETURN TOSTRING(42) AS int_to_str,
       TOSTRING(3.14) AS float_to_str,
       TOSTRING(true) AS bool_to_str

Result:

int_to_strfloat_to_strbool_to_str
"42""3.14""true"

TOBOOLEAN()

Converts a value to a boolean.

Syntax:

TOBOOLEAN(value) -> boolean

Example:

GQL
RETURN TOBOOLEAN('true') AS str_to_bool,
       TOBOOLEAN(1) AS int_to_bool

Result:

str_to_boolint_to_bool
truetrue

TOLIST()

Converts a value to a list.

Syntax:

TOLIST(value) -> list

Example:

GQL
RETURN TOLIST('hello') AS str_to_list

Result:

str_to_list
["h", "e", "l", "l", "o"]