to_int()

Converts the string token to an integer. This is a token function for the WHERE clause of a LOAD statement only. It cannot be used in a destination clause.

This function is necessary when you need to filter integer values during loading, as all tokens are treated as strings.

Syntax

to_int( token )

Return value

INT. The integer converted from the input token.

Example

If we have the following data in a CSV file of the different scores of test takers, and we want to load a record if their score is higher than 95:

name score

Tommy

95

Amy

99

Amy

93

LOAD f TO VERTEX Person
  VALUES ($"name", $"score")
  WHERE to_int($"score") > 95

After loading, only the second row in the provided data is loaded, as it is the only record where the score is greater than 95.