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.

r()

Usage

r(<R code>)

Description
Interpretes R code

Search results for "r()"

render()

Renders the HTML representation of the given node(s) into the output buffer. This method is exactly equivalent to the rendering process that Structr uses internally to create the HTML output of pages etc. It can be used to render dynamic content in pages with placeholders etc.
Together with include(), render() is one of the the most important method when dealing with HTML web templates, since it allows the user to fill static HTML pages with dynamic content from the underlying node structure. See Page Rendering for more information on this topic.

render(nodes)
render(node)

mail_get_error()

New in v.3.6: Allows to retrieve the last error message when sending a mail.

${mail_get_error()}

or()

Returns the logical OR result of the given boolean values.

or(boolean1, boolean2, ...)

abbr()

Abbreviates the given string at the last space character before the maximum length is reached.
The remaining characters are replaced with the ellipsis character (…) or the given abbr parameter.

abbr(string, maxLength [, abbr = '…' ] )

add_header()

Temporarily adds the given (key, value) tuple to the local list of request headers. All headers in this list will be added to any subsequent GET(), HEAD(), POST(), PUT() or DELETE() call in the same request (meaning the request from the client to structr).

add_header(key, value)

get_request_header()

Returns the value of the HTTP request header with the given name. This method can be used both in Entity Callback Functions and in the Page Rendering process to obtain the value of a given HTTP header, allowing the user to use HTTP headers from their web application clients to control features of the application.

get_request_header(name)

set_response_header()

Sets the value of the HTTP response header with the given name to the given value. This method can be used to set and/or override HTTP response headers in the Structr server implementation to control certain aspects of browser / client behaviour.

set_response_header(name, value)
set_response_header(name, value [, override]) // New in v.3.6

filter()

Filters the given collection according to the given filter expression, returning a subset of the original collection. The filter expression can be any valid expression that returns a boolean value. This method can be used to remove single or multiple elements from an existing list of objects. The individual objects of the collection are passed into the filter expression sequentially, using the data key data.

The function will remove any object from the collection for which the filter expression returns false.

filter(collection, filterExpression)

get_counter()

Returns the counter value for the given level.

get_counter(level)

inc_counter()

Increases the counter value for the given level, optionally resetting the value of all counters below the given level with the second parameters, which accepts a boolean value.

inc_counter(level, resetLowerLevels)
inc_counter(level)

error()

This method can be used to signal an error condition while scripting execution. It is mainly used in entity callback functions like onCreate() or onSave() to allow the user to implement custom validation logic.

If an error is raised the current transaction will be rolled back and no changes will be written to the database.

error(propertyKey, token, detail)
error(propertyKey, token)

floor()

Returns the given value, rounded down to the nearest integer. This method tries to convert its parameter objects into numerical values, i.e. you can use strings as arguments.

floor(val)

mail_add_header()

Adds a custom header to the mail.

mail_add_header(name, value)

mail_remove_header()

Removes a single custom header from the mail.

mail_remove_header(name)

has_error()

Allows checking if an error has been raised in the scripting context

has_error()

r()

Interpretes R code. (See the Scripting Guide for more info on supported languages)

r(<R code>)

reset_counter()

Resets the counter for the given level.

reset_counter(level)

timer()

This method can be used to measure the performance of sections of code. The action parameter can be start to create a new timer or get to retrieve the elapsed time (in milliseconds) since the start of the timer.

timer(name, action)

cypher()

Executes the given Cypher query and returns the results. Structr will automatically convert all query results into the corresponding Structr objects, i.e. Neo4j nodes will be instantiated to Structr node entities, Neo4j relationships will be instantiated to Structr relationship entities, and maps will converted into Structr maps that can be accessed using the dot notation (map.entry.subentry).

cypher(query [, key1, value1 [, ... ]] )
cypher(query [, map] )

lower()

Returns the lowercase value of the given string.

lower(string)