You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

extract()

Usage

extract(collection, propertyKey)

Description
This method iterates over the contents of the given entity collection and extracts the value for the given property key of each element. The return value of this method is a collection of extracted property values. It is often used in combination with find() and join() to create comma-separated lists of entity values.

Examples

<div>${extract(find('User'), 'name')}</div>

results in

<div>[admin, user1, user2, user3]</div>

Search results for "extract()"

extract()

This method iterates over the contents of the given entity collection and extracts the value for the given property key of each element. The return value of this method is a collection of extracted property values. It is often used in combination with find() and join() to create comma-separated lists of entity values.

extract(collection, propertyKey)

StructrScript

The above example shows the use of three different built-in functions. The find() function executes a database query and returns the result collection. extract() converts the collection of database objects into a collection of strings and join() concatenates the collection of strings into a single string, using the given separator between the elements.