CDL Functions

You can include a function in an expression.

  • The function does an operation on its arguments.
  • The function returns a value that you can use to evaluate the entire statement.
  • You can use the value that the function returns in other parts of the expression.
  • You can use the result as an operand of another operator or function. The result’s data type must match the data type that you use in the other operator's or function's argument.

Note

  • A function includes one or more arguments.
  • You must enclose the function's arguments in parentheses.
  • If your expression has more than one function, then you must use a comma to separate each function.
  • An argument can be an expression.

This example includes operations for the Round function. Feature-x and Feature-y must be numeric features:

Round (13.4)
Round (Feature-x / Feature-y)

You can use these types of functions.

  • Arithmetic
  • Trigonometric
  • Logical
  • Set
  • Text
  • Hierarchy or Compound

Arithmetic Functions

Function Description
Abs(x)
  • Takes a single number as an argument and returns the positive value of that number. For example, Abs(-12345.6) returns a value of 12345.6.
  • The argument’s value can be -infinity to +infinity.
  • The return value can be 0 to infinity.
AggregateSum(x)
  • You can use it in a rule that's in the Constraint, Default, or Search Decision class, but only as a subexpression.
Ceiling(x)
  • Takes a single decimal number as an argument and returns the next higher integer. For example, ceiling(4.3) returns 5, and ceiling(-4.3) returns -4.
Exp(x)
  • Takes a single number between -infinity and +infinity and returns a value between 0 and +infinity.
  • Returns e raised to the x power.
Floor(x)
  • Takes a single decimal number as an argument and returns the next lower integer. For example, floor(4.3) returns 4, and floor(-4.3) returns -5.
Log(x)
  • Takes a single number that's greater than 0 and less than +infinity and returns a number between -infinity and +infinity.
  • Returns the logarithmic value of x.
  • If x=0, then an error happens.
Log10(x)
  • Takes a single number that's greater than 0 and less than +infinity and returns a number between -infinity and +infinity.
  • Returns the base 10 logarithmic value of x.
  • If x=0, then an error happens.
Max(x,y,z...)
  • Returns the largest of its numeric arguments.
Min(x,y,z...)
  • Returns the smallest of its numeric arguments.
Mod(x,y)
  • Returns the remainder of x divided y, where x and y are each a number between -infinity and +infinity.
  • If y is 0, then you're attempting to divide by 0 and Oracle Configurator returns an error.
  • If x=y, then the result is 0. For example, Mod(7,5) returns 2.
  • This is a binary function.
Pow(x,y)
  • Returns the result of x raised to the power of y. For example, Pow(6,2) returns 36.
  • The number x is between -infinity and +infinity.
  • The integer y is between -infinity and +infinity and the returned result is between -infinity and +infinity.
  • If y=0, then the result is 1.
  • This is a binary function.
Round(x)
  • Takes a single decimal number as an argument and returns the nearest integer.
  • If the left side of a numeric rule is a decimal number, and if this number is part of a bill of materials that you import, and if that bill of materials can use a decimal quantity, then you can't use the Round(x) function.

    You can't use it because the right side of the equation accepts a decimal quantity, so you don't need to round the value. Round(x)is available when the item on the bill of materials accepts only integer values.

RoundDownToNearest(x,y)
  • Rounds the first argument to the nearest smaller multiple of the second argument. For example, RoundDownToNearest(433,75) returns a value of 375.
  • x is a number between -infinity and +infinity
  • y is a number that's greater than 0 and less than +infinity.
  • It returns a number between -infinity and +infinity.
  • This is a binary function.
RoundToNearest(x,y)
  • Returns a number between -infinity and +infinity. For example, RoundToNearest(433,10) returns 430.
  • x is a number between -infinity and +infinity
  • y is a number that's greater than 0 and less than +infinity.
  • This is a binary function.
RoundUpToNearest(x,y)
  • Rounds the first argument up to the nearest multiple of the second argument. For example, RoundUpToNearest(34.1,0.125) returns 34.125.
  • x is a number between -infinity and +infinity,
  • y is a number that's greater than 0 and less than +infinity.
  • Returns a number that's between -infinity and +infinity.
  • This is a binary function.
Sqrt(x)
  • Returns the square root of x.
  • Takes a single number between 0 and +infinity and returns a value between 0 and +infinity.
  • If you provide a negative value for x, then Configurator displays an error.
Truncate(x)
  • Takes a single decimal number x and truncates it, removing all digits after the decimal point. For example, truncate(4.15678) returns 4.

The term infinity means its value has no limit. It can be infinite in the positive direction or in the negative direction.

  • -infinity means that the value can be any value that's zero or smaller than zero.
  • +infinity means that the value can be any value that's zero or greater than zero.

Trigonometric Functions

Function Description
Sin(x)
  • Takes a single number x that's between -infinity and +infinity and returns a value that's between -1 and +1.
ASin(x)
  • Takes a single number that's between -1 and +1 and returns a value that's between -pi/2 and +pi/2.
  • Returns the arc sine of x.
  • If you provide a value for x that's outside the range between -1 and +1, then Configurator displays an error.
Sinh(x)
  • Returns the hyperbolic sine of x in radians.
  • Takes a single number that's between -infinity and +infinity and returns a value that's between -1 and +infinity.
  • If you provide a negative value for x, and if the result exceeds the double, then Configurator displays an error. For example, sinh(-99) will work but sinh(999) will create an error.
Cos(x)
  • Takes a single number that's between -infinity and +infinity and returns a value that's between -1 and +1.
  • Returns the cosine of x.
ACos(x)
  • Takes a single number that's between -1 and +1 and returns a value that's between 0 and pi.
  • ACos(x) returns the arc cosine of x.
  • If you provide a negative value for x, or if you provide a value for x that's outside the range between -1 and +1, then Configurator displays an error.
Cosh(x)
  • Takes a single number that's between -infinity and +infinity and returns a value that's between -infinity and +infinity.
  • Returns the hyperbolic cosine of x in radians.
  • If you provide a negative value for x, and if x exceeds the maximum value of a double, then Configurator displays an error. For example, cosh(-200) will work but cosh(-2000) will create an error.
Tan(x)
  • Takes a single number x that's between -infinity and +infinity and returns a value that's between -infinity and +infinity.
ATan(x)
  • Takes a single number that's between -infinity and +infinity and returns a value that's between -pi/2 and +pi/2.
  • ATan(x) returns the arc tangent of x.
Tanh(x)
  • Returns the hyperbolic tangent of x.
  • Takes a single number x that's between -infinity and +infinity and returns a value that's between -1 and +1.

Logical Functions

Function Description
AllTrue
  • A logical AND expression.
  • Accepts one or more logical values or expressions.
  • If all of the arguments are true, then it returns a value of true.
  • If all of the arguments are false, then it returns a value of false.
  • If all of the arguments aren't true, and if all of the arguments aren't false, then it returns a value of unknown.
AnyTrue
  • A logical OR expression.
  • Accepts one or more logical values or expressions.
  • If any of the arguments are true, then it returns a value of true.
  • If all of the arguments are false, then it returns a value of false.
  • If all of the arguments aren't true, and if all of the arguments aren't false, then it returns a value of unknown.
Not
  • Accepts a single logical value or expression.
  • If the argument is false or unknown, then it returns a value of true.
  • If the argument is true, then it returns a value of unknown.

Text Functions

Each of these text functions compares two operands of text literals.

Function Description
BeginsWith If the first character of the first operand matches the first character of the second operand, then it returns true.
Contains If the value in the first operand contains the value in the second operand, then it returns true.
EndsWith If the last character of the first operand matches the last character of the second operand, then it returns true.
Equals If the value in the first operand equals the value in the second operand, then it returns true.
Matches If the value in the first operand matches the value in the second operand, then it returns true.
NotEquals If the value in the first operand doesn't equal the value in the second operand, then it returns true.

Note

  • Don't use a text function in the body of a constraint or statement that accumulates a value unless it evaluates to a constant string. Configurator will validate this condition.
  • You can use a text function can with static text. For example, in the WHERE clause of an iterator.

Option Function

Function Description
OptionsOf Takes the name of an option class or a feature as an argument and returns its options.