Skip to main content

The Tools JavaScript library

JavaScript methods to reformat data.

Helper tools to transform data.

Methods

JavaScript API methods for interacting with _tools. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

formatDataAsArray

Formats data as an array.

tools.formatDataAsArray(formatDataAsArrayOptions)
Parameters

formatDataAsArrayOptions

object
Properties

data

any[]

The source data.


outputArrayOfArrays

boolean

Whether to output an array of arrays.




formatDataAsObject

Formats data as an object.

tools.formatDataAsObject(formatDataAsObjectOptions)
Parameters

formatDataAsObjectOptions

object
Properties

data

any[]

The source data.




swap

Swap the position of two array items.

tools.swap(swapOptions)
Parameters

swapOptions

object
Properties

data

any[]

The source data.


indexA


indexB