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.

empty()

Usage

empty(obj)

Description
Returns a boolean value that indicates whether the given object is null or empty.

Note
Before the Structr 2.1 release this method did not work on collections/arrays. If you are running an older version of Structr and want to determine if a collection is empty, use gt() in combination with size() for that.

Examples

${empty("")}
${empty("test")}
${empty(find("User"))}
${empty(find("NonExistentType"))}

results in

true
false
false (if at least one user exists)
true

Search results for "empty()"

empty()

Returns a boolean value that indicates whether the given object is null or empty.

empty(obj)

Scripting Migration

Only occurrences which are used in advanced find need to be prefixed. Some of those predicates also exist as regular functions ($.sort(), $.empty(), …) or keywords ($.page).