Show TOC

Background documentationRedwood Function Library Locate this document in the navigation structure

 

  • Built in functions

  • BaseString - Prefix: None.

  • BaseCast - Prefix: None.

  • BaseMath - Prefix: Math

  • BaseCast - Prefix: Casts

  • ModuleScriptingJobChainParameters - Prefix: JobChainParameters

  • ModuleScriptingQuery - Prefix: Query

  • ModuleScriptingVariable - Prefix: Variable

  • ModuleScriptingTable - Prefix: Table

  • ModuleScriptingConstraint - Prefix: Constraint

  • ExtendedTime - Prefix: Time

  • ExtendedRange - Prefix: Range

  • ModuleScriptingSap - Prefix: SAP

  • BaseTime - Prefix: Time

  • BaseRange - Prefix: Range

BaseCast

Prefix: BaseCast

Availability: Always.

ToBoolean

Signature: Object BaseCast.ToBoolean(Object arg)

Availability: Always.

Convert arg to a boolean (true/false) if possible.

ToNumber

Signature: Object BaseCast.ToNumber(Object arg)

Availability: Always.

Convert arg to a number if possible.

ToInteger

Signature: Object BaseCast.ToInteger(Object arg)

Availability: Always.

Convert arg to an integer if possible.

ToString

Signature: Object BaseCast.ToString(Object arg)

Availability: Always.

Convert arg to a string.

ToYN

Signature: Object BaseCast.ToYN(Object arg)

Availability: Always.

Convert arg to Y for true and N for any other value.

BaseMath

Prefix: BaseMath

Availability: Always.

abs

Signature: BigDecimal BaseMath.abs(BigDecimal x)

Availability: Always.

Calculate the absolute value of x.

floor

Signature: BigDecimal BaseMath.floor(BigDecimal x)

Availability: Always.

Calculate the floor (greatest integer less than) of x.

ceil

Signature: BigDecimal BaseMath.ceil(BigDecimal x)

Availability: Always.

Calculate the ceiling (least integer greater than) of x.

round

Signature: BigDecimal BaseMath.round(BigDecimal x)

Availability: Always.

Round x. If x ends in .5, it will be rounded up.

BaseRange

Prefix: BaseRange

Availability: Always.

Functions for working with sets and ranges. Set is written as "XXXXXXX" where X is either '_' or a letter and the first X represents 0 (or Sunday for days of the week, or January for months). Any letter is in the set, and '_' is not in the set. Example sets: Ranges are made up of comma separated sections, each of which is a number (eg. 1) or a range of numbers (eg. 4-7). All numbers specified are in the range, other numbers are not.

Set

X's

English

First month of the quarter

X__X__X__X__

J__A__M__O__

Last month of the quarter

__X__X__X__X

__M__J__S__D

Not last month of the quarter

XX_XX_XX_XX_

JF_AM_JA_ON_

Monday, Wednesday, Friday

_X_X_X_

_M_W_F_

Saturday, Sunday

X_____X

S_____S

inRange

Signature: boolean BaseRange.inRange(int candidate, String trueRange)

Availability: Always.

Return true if candidate is in the range specified by trueRange.

inSet

Signature: boolean BaseRange.inSet(int candidate, String trueSet)

Availability: Always.

Return true if candidate is in the set specified by trueRange.

BaseString

Prefix: BaseString

Availability: Always.

Functions for working with Strings.

currentObject.concat

Signature: String BaseString.currentObject.concat(String s1, ...)

Availability: Always.

Concatenate strings to currentObject. Any number of other objects may be passed as arguments.

currentObject.toString

Signature: String BaseString.currentObject.toString()

Availability: Always.

Convert currentObject to a string.

currentString.charAt

Signature: String BaseString.currentString.charAt(int pos)

Availability: Always.

Get character at pos in currentString.

currentString.indexOf

Signature: int BaseString.currentString.indexOf(String searchFor, [int startIndex])

Availability: Always.

Get the first index of the string searchFor in currentString, optionally starting at startIndex (default=0).

currentString.lastIndexOf

Signature: int BaseString.currentString.lastIndexOf(String searchFor, [int startIndex])

Availability: Always.

Get the last index of the string searchFor in the currentString, optionally starting at startIndex (default=0).

currentString.split

Signature: String[] BaseString.currentString.split(String separator, int limit)

Availability: Always.

Split currentString into an array using the specified separator. Limit the length of the array to limit elements.

currentString.substring

Signature: String BaseString.currentString.substring([int startIndex] [, int endIndex])

Availability: Always.

Get a substring of currentString, starting at startIndex (defaults to zero) and ending at endIndex (defaults to the end of the string).

currentString.toLowerCase

Signature: String BaseString.currentString.toLowerCase()

Availability: Always.

Convert currentString to lower case.

currentString.toUpperCase

Signature: String BaseString.currentString.toUpperCase()

Availability: Always.

Convert currentString to upper case

BaseTime

Prefix: BaseTime

Availability: Always.

Time expressions are a sequence of operations, applied in order to a time (generally now, but may be a specified date). They may be: The <value> is always a number: The <specifier> is one of: Plurals with an additional 's' are accepted (eg. days, weeks, ...). The day is always the day of the month, and dow is the day of the week. Example time expressions:

  • set <specifier> <value> - set <specifier> to <value>

  • add <value> <specifier> - add <value> to <specifier> (This may propagate)

  • subtract <value> <specifier> - subtract <value> from <specifier> (This may propagate)

  • truncate <specifier> - truncate at <specifier> (This will zero <specifier> and everything below it).

  • The days of the week start at 1 for Sunday.

  • The days of the year start at 1 for 1 January.

  • add/subtract: second, minute, hour, day, week, month, year

  • truncate: second, minute, hour, day, week, month

  • set: second, minute, hour, day, dow, day_of_year, week, week_of_month, month

  • add 1 minute

  • add 3 seconds

  • set hour 1

  • truncate day

  • subtract 2 days

now

Signature: DateTimeZone BaseTime.now([String timeZoneName])

Availability: Always.

Return the time in the context time zone (generally the time zone of the job). This can be optionally overridden by specifying the Olson name of a time zone as timeZoneName.

expression

Signature: DateTimeZone BaseTime.expression(Object date, String expression)

Availability: Always.

Apply expression to the date specified.

expressionNow

Signature: DateTimeZone BaseTime.expressionNow(String expression)

Availability: Always.

Apply expression to the current time.

isTimeWindowOpenNow

Signature: boolean BaseTime.isTimeWindowOpenNow(String timeWindow)

Availability: Always.

Return true if the time window timeWindow is open now, false otherwise.

isTimeWindowOpen

Signature: boolean BaseTime.isTimeWindowOpen(Object date, String timeWindow)

Availability: Always.

Return true if the time window timeWindow is open on the specified date, false otherwise.

ExtendedRange

Prefix: ExtendedRange

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

inRangeWarning

Signature: boolean ExtendedRange.inRangeWarning(int candidate, String trueRange, String warningRange, int severity, String message)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Return true if candidate is in the range specified by trueRange. Return true, but log a warning operator message ifcandidate is in warningRange. The operator message is specified by the message and severity parameters.

ExtendedRepository

Prefix:

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

queryHTMLTable

Signature: int .queryHTMLTable(String query [, Object [] bindVariables])

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Produce HTML output on stdout for the query query with optional bind variables bindVariables. Bind variable place holders are specified as ? in the query.

queryCSV

Signature: int .queryCSV(String query [, Object [] bindVariables])

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Produce CSV output on stdout for the query query with optional bind variables bindVariables. Bind variable place holders are specified as ? in the query.

exists

Signature: boolean .exists(VisitorContext context, String statement, Object [] bindVariables)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

queryDateTimeZone

Signature: DateTimeZone .queryDateTimeZone(VisitorContext context, String statement, Object [] bindVariables)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

queryDate

Signature: Date .queryDate(VisitorContext context, String statement, Object [] bindVariables)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

ExtendedTime

Prefix: ExtendedTime

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

isDayOfWeekInSetNow

Signature: boolean ExtendedTime.isDayOfWeekInSetNow(String weekSet)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is the current day of the week in weekSet.

isDayOfWeekInSet

Signature: boolean ExtendedTime.isDayOfWeekInSet(Object date, String weekSet)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is the day of the week of date in weekSet.

isDayInRangeNow

Signature: boolean ExtendedTime.isDayInRangeNow(String dayRange)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is the current day of the month in the range dayRangeSet.

isDayInRange

Signature: boolean ExtendedTime.isDayInRange(Object date, String dayRange)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is the day of the month of date in the range dayRangeSet.

isLastDayInMonthNow

Signature: boolean ExtendedTime.isLastDayInMonthNow(ScriptEvaluationContext context)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is it currently the last day of the month?

isLastDayInMonth

Signature: boolean ExtendedTime.isLastDayInMonth(Object date)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is the date specified the last day of that month?

isMonthInSetNow

Signature: boolean ExtendedTime.isMonthInSetNow(String monthRange)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is the month of the current date in the range monthRange?

isMonthInSet

Signature: boolean ExtendedTime.isMonthInSet(Object date, String monthRange)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Is the month of the specified date in the range monthRange?

format

Signature: String ExtendedTime.format(Object date, String format)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Format the date according to the specified .

formatDuration

Signature: String ExtendedTime.formatDuration(BigDecimal duration)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Format a duration using the standard format: |1 week, |# weeks, |1 day, |# days, |#|:#|:#|.#

formatDurationEx

Signature: String ExtendedTime.formatDurationEx(BigDecimal duration, String format)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Format a duration using a custom format. The format is specified as: |1 week, |# weeks, |1 day, |# days, |#|:#|:#|.#| The first element is used for 1 week. The second element is used for n weeks, where n > 1. The third element is used for 1 day. The fourth element is used for n days, where n > 1. The fifth element is used for hours. The sixth element is used for minutes. The seventh element is used for seconds. The eighth element is used for milliseconds. In all elements but the first and third, # is replaced with the actual number. If an element is empty it is omitted. If the first element is empty, weeks are not printed and and days may be greater than 7. If the third element is empty, days are not printed and and hours may be greater than 24.

getUTCMillisecondsNow

Signature: BigDecimal ExtendedTime.getUTCMillisecondsNow()

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Get the number of milliseconds since midnight on January 1 1970 for the current time.

getUTCMilliseconds

Signature: BigDecimal ExtendedTime.getUTCMilliseconds(Object date)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Get the number of milliseconds since midnight on January 1 1970 for the specified time.

formatNow

Signature: String ExtendedTime.formatNow(String format)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Format the current date according to the specified .

parse

Signature: DateTimeZone ExtendedTime.parse(Object string, String format)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Parse the string into a date according to the specified .

nextTimeWindowOpeningNow

Signature: DateTimeZone ExtendedTime.nextTimeWindowOpeningNow(String timeWindow)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Next opening of timeWindow after now.

nextTimeWindowOpening

Signature: DateTimeZone ExtendedTime.nextTimeWindowOpening(Object date, String timeWindow)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Next opening of timeWindow after the specified date.

nextTimeWindowClosingNow

Signature: DateTimeZone ExtendedTime.nextTimeWindowClosingNow(String timeWindow)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Next opening of timeWindow after now.

nextTimeWindowClosing

Signature: DateTimeZone ExtendedTime.nextTimeWindowClosing(Object date, String timeWindow)

Availability: RedwoodScript only. Requires 'Module.AdvancedScripting' key.

Next opening of timeWindow after the specified date.

ModuleScriptingConstraint

Prefix: ModuleScriptingConstraint

Availability: Requires 'Module.Scripting' key.

listConstraint

Signature: boolean ModuleScriptingConstraint.listConstraint(String titles, String list, boolean valid)

Availability: Requires 'Module.Scripting' key.

pairListConstraint

Signature: boolean ModuleScriptingConstraint.pairListConstraint(String titles, String list, boolean valid)

Availability: Requires 'Module.Scripting' key.

ModuleScriptingJobChainParameters

Prefix: ModuleScriptingJobChainParameters

Availability: Requires 'Module.Scripting' key.

Job chain job names take the form Step name, job job number. For example: "Step 2, job 3" or "Data load, job 2".

getOutValueString

Signature: String ModuleScriptingJobChainParameters.getOutValueString(String jobName, String parameterName)

Availability: Requires 'Module.Scripting' key.

Get the value of the String output parameter parameterName of the job named jobName in the current job chain.

getOutValueNumber

Signature: BigDecimal ModuleScriptingJobChainParameters.getOutValueNumber(String jobName, String parameterName)

Availability: Requires 'Module.Scripting' key.

Get the value of the Number output parameter parameterName of the job named jobName in the current job chain.

getOutValueDate

Signature: DateTimeZone ModuleScriptingJobChainParameters.getOutValueDate(String jobName, String parameterName)

Availability: Requires 'Module.Scripting' key.

Get the value of the Date output parameter parameterName of the job named jobName in the current job chain.

getInValueString

Signature: String ModuleScriptingJobChainParameters.getInValueString(String jobName, String parameterName)

Availability: Requires 'Module.Scripting' key.

Get the value of the String input parameter parameterName of the job named jobName in the current job chain.

getInValueNumber

Signature: BigDecimal ModuleScriptingJobChainParameters.getInValueNumber(String jobName, String parameterName)

Availability: Requires 'Module.Scripting' key.

Get the value of the Number input parameter parameterName of the job named jobName in the current job chain.

getInValueDate

Signature: DateTimeZone ModuleScriptingJobChainParameters.getInValueDate(String jobName, String parameterName)

Availability: Requires 'Module.Scripting' key.

Get the value of the Date input parameter parameterName of the job named jobName in the current job chain.

getJobId

Signature: Long ModuleScriptingJobChainParameters.getJobId(String jobName)

Availability: Requires 'Module.Scripting' key.

Get the job id of the job named jobName in the current job chain.

getJobStatus

Signature: String ModuleScriptingJobChainParameters.getJobStatus(String jobName)

Availability: Requires 'Module.Scripting' key.

Get the job status of the job named jobName in the current job chain.

ModuleScriptingQuery

Prefix: ModuleScriptingQuery

Availability: Requires 'Module.Scripting' key.

getNumber

Signature: BigDecimal ModuleScriptingQuery.getNumber(String query [, Object [] bindVariables])

Availability: Requires 'Module.Scripting' key.

Get the first column of the first row of the query query with optional bind variables bindVariables. Bind variable place holders are specified as ? in the query.

getString

Signature: String ModuleScriptingQuery.getString(String query [, Object [] bindVariables])

Availability: Requires 'Module.Scripting' key.

Get the first column of the first row of the query query with with optional bind variables bindVariables. Bind variable place holders are specified as ? in the query.

getRelativeJob

Signature: BigDecimal ModuleScriptingQuery.getRelativeJob(String jobName)

Availability: Requires 'Module.Scripting' key.

Get the job id of the job named jobName in the current job chain.

ModuleScriptingSap

Prefix: ModuleScriptingSap

Availability: Requires 'Module.Scripting' key.

convertJobParameterRangesToExpression

Signature: String ModuleScriptingSap.convertJobParameterRangesToExpression(String jobName, String parameterName, int fieldLength)

Availability: Requires 'Module.Scripting' key.

Get the value of the String output parameter parameterName of the job named jobName in the current job chain. Convert ranges to a selopt expression. Ranges are sent as a long string in the form [<sign><option><low><high>]+ where <sign> is a single character I or E <option> a select option, e.g. EQ, BT <low> the low value of the range <high> the high value of the range All fields are always sent, regardless of the value of the <option>. If the value is shorter than the length of the field, it is padded with blanks. Such ranges are known to be sent by Closing Cockpit.

convertRangesToExpression

Signature: String ModuleScriptingSap.convertRangesToExpression(String rangesString, int fieldLength)

Availability: Requires 'Module.Scripting' key.

Convert ranges to a selopt expression. Ranges are sent as a long string in the form [<sign><option><low><high>]+ where <sign> is a single character I or E <option> a select option, e.g. EQ, BT <low> the low value of the range <high> the high value of the range All fields are always sent, regardless of the value of the <option>. If the value is shorter than the length of the field, it is padded with blanks. Such ranges are known to be sent by Closing Cockpit.

ModuleScriptingTable

Prefix: ModuleScriptingTable

Availability: Requires 'Module.Scripting' key.

getRow

Signature: String ModuleScriptingTable.getRow(String table, String key)

Availability: Requires 'Module.Scripting' key.

getColumnString

Signature: String ModuleScriptingTable.getColumnString(String tableName, String key, String column)

Availability: Requires 'Module.Scripting' key.

getColumnNumber

Signature: BigDecimal ModuleScriptingTable.getColumnNumber(String table, String key, String column)

Availability: Requires 'Module.Scripting' key.

formatRow

Signature: String ModuleScriptingTable.formatRow(String table, String key, String rowStart, String columnFormat, String columnSeparator, String rowEnd)

Availability: Requires 'Module.Scripting' key.

ModuleScriptingVariable

Prefix: ModuleScriptingVariable

Availability: Requires 'Module.Scripting' key.

getString

Signature: String ModuleScriptingVariable.getString(String key)

Availability: Requires 'Module.Scripting' key.

getNumber

Signature: BigDecimal ModuleScriptingVariable.getNumber(String key)

Availability: Requires 'Module.Scripting' key.