Redwood Documentation

Product Documentation

 

›Reference

RunMyJobsRedwoodScript Development

Developing Applications

  • Developing Applications

RedwoodScript

  • RedwoodScript
  • Scripting in the Shell
  • Mixing REL and RS Code in a Library
  • Controlling Process Servers with RedwoodScript
  • Controlling Queues with RedwoodScript
  • Managing Applications with RedwoodScript
  • Substitution Parameters
  • Date Formatting and Parsing
  • Impact of Modified Process Definitions or Chain Definitions on Processes and Chains
  • Using the RedwoodScript Definition Type
  • Using RedwoodScript in Processes
  • Using Eclipse to Create and Edit Process Definitions

Debugging Your Code

  • Changing Process Logging Levels

Triggering Custom Code

  • Triggering Custom Code
  • Using Triggers
  • Trigger and Action Examples
  • Using Actions
  • Executing Your Own Classes from a Library
  • Library Examples
  • Extending Redwood Server Functionality with Extension Points
  • Extending Edit Pages with ObjectPageExtensionPoint
  • Creating Extension Points
  • Extending Redwood Server Functionality with Extension Points

Using Tables

  • Using Tables to Store Frequently Used Values

PL/SQL API

  • Cronacle PL/SQL API Module
  • Creating the OracleJob Process Server
  • Using the OracleJob Definition Type
  • Packages
  • RS/JCS Views

Tuning Redwood Platform

  • Tuning Redwood Platform

Memory Tuning

  • Tuning Memory Usage and Garbage Collection

Reference

  • Using SQL to Query the Data Model
  • Embed Redwood Server Overviews into Extension Points with the Embed API
  • API Documentation
  • Script Date Formats
  • Datamodel
  • Redwood Expression Language Functions and Implicit Objects
  • RedwoodScript Scripting Contexts and Implicit Objects
← Tuning Memory Usage and Garbage CollectionEmbed Redwood Server Overviews into Extension Points with the Embed API →

Using SQL to Query the Data Model

Redwood Server allows you to query the data model in reports, query filters, RedwoodScript is well as REL expressions. In query filters you only specify what comes after the where clause.

Functions

The following functions have been implemented:

  • AVG(<expression> | DISTINCT column-name) - calculates the average
  • COUNT( DISTINCT column-name | * ) - returns the number of items in a group
  • FORMAT_EXPRESSION(<expression>, <format>[, <timezone>]) - <expression> conforms to Time.expressionNow(), <format> conforms to SimpleDateFormat.
  • FORMAT_NOW(<format>[, <timezone>]) - <format> conforms to SimpleDateFormat.
  • MAX(<expression>) - calculate the maximum value from <expression>
  • MIN() - calculate the minimum value from <expression>
  • NOW([<expression>]) - <expression> conforms to Time.expressionNow() REL function expression.
  • SUM([ DISTINCT | ALL ] expression ) - returns a sum

See Extended Time Functions for more information on syntax.

note

Depending on the underlying database, these functions may not always return the expected value. Please see the documentation of your database vendor for implementation specifications.

Example

Credentials

You want to query credentials for soap credentials

=Query.getString('select Credential.* from Credential where Credential.CredentialProtocol in
(select CredentialProtocol.UniqueId from CredentialProtocol where CredentialProtocol.Name = ?'), 'soap')

Processes

Create a report of a list of processes that have a requested start time between 11:00 in morning today or yesterday and 11:00 tomorrow morning or today, depending on what time it currently is.

=Query.getString('select Job.* from Job where
Job.RequestedStartTimeInternal > now(\'subtract 11 hours set hour 11 truncate hour\')
and Job.RequestedStartTimeInternal < now(\'add 13 hours set hour 11 truncate hour\')')

Functions

AVG - used as average runtime, here: long runners of the last 7 days

=Query.getString('Select Job.* from Job where
Job.RunTime > (select avg(Job.RunTime) from Job where Job.RequestedStartTimeInternal > now(\'set hour 0 subtract 7 days\'))
and Job.RequestedStartTimeInternal > now(\'set hour 0 subtract 7 days\')')

Writing your own Custom SQL

To write your own custom SQL, you need to inspect the data model available in the API documentation. In this example, you query the Credential table and you want filter by credential protocol; in the datamodel, you see the CredentialProtocol field of the Credential table is of type BIGINT which means that it will contain the UniqueID of the credential protocol. You thus have to select the UniqueID of the credential protocol from the CredentialProtocol table.

See Also

  • SQL BNF
  • http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt
  • Redwood Expression Language Functions

SQL

← Tuning Memory Usage and Garbage CollectionEmbed Redwood Server Overviews into Extension Points with the Embed API →
  • Functions
  • Example
  • Credentials
  • Processes
  • Functions
  • Writing your own Custom SQL
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |