BML Overview
Overview
BML (BigMachines Extensible Language) is a scripting tool that is used to capture a company's complex business logic within Oracle CPQ Configuration and Commerce. BML is based of many different programming languages.
You will see syntax that is familiar in Java, Basic, Python, and C++, but they aren’t exactly the same. After reading the section on BML, you should have a good understanding of what programming language is and how it’s used and structured. You should also understand the syntax of BML and have generated some very basic and functional code.
What is a function?
A function is usually defined as a rule that relates one variable value to another. In programming, it also represents a series of commands that perform an action or calculate a value depending upon certain parameters. Parameters are the values that the function uses. But, not all functions require parameters. For more information, see the topic Function Editor Basics.
What is a variable?
Variables are placeholders for the data, which a program may use or manipulate. They are given unique names so that they can be assigned values and referred to throughout the source code. In order to use a variable, you must declare it by giving it a unique name. In many programming languages, once a variable is declared, it must be initialized. However, in BML, these two steps occur simultaneously.
Variables can be used for Column names, Table names, and WHERE clauses. For more information, see the topic Dynamic BMQL Variables.
Administration
Programming Language
A programming language is an artificial language that is used to write instructions that a computer can understand. Programming languages can be broken down into two groups:
1. Compiled programming: this is a language that must be converted into machine language, after it’s been written by the programmer, so that a computer can understand and execute the instructions. These languages require the use of special software (called a compiler) prior to being executed.
2. Interpretive programming: this language do not have to be compiled. The computer understands and executes the instructions while the program is running. See examples below.
BML has characteristics of both languages. It’s a Java based mark-up language, so it does need to be compiled, but that is done within the application.
Programming Structure
BML follows the Structured computer programming model (not Object-Oriented model). Structured programming uses blocks of code that are executed one after the other. They include control statements which dictate the flow, or when these statements are executed. Almost all structured programming, including BML, shares a similar overall structure. They include:
- Statements to establish the start of the program
- Variable declarations
- Source code (blocks of programming statements)
- In BML (a return statement is always required)
Basic Data Types
Almost all programming languages include the use of data types. A data type determines the values that a variable can contain and how it is executed. A data type also represents a constraint placed on the interpretation of data. There are four basic data types:
- Integer: Data is stored as a whole number. When assigning any value that contains a decimal or a different character, it's either rounded or an error is thrown.
- Float: Data is stored and/or returned with a decimal.
- String: Allows text output of any kind to be returned. In BML, string variables will always reside within double quotations ("").
- Boolean: Returns either a True or False, based on your inputs.
Common Statement Elements
; |
Represents and end statement. This is required on each line of code. |
// |
Indicates a comment line. |
return |
This is the beginning of the return statement which is required at the end of your code. BML will not process instructions without it. |
print |
This function displays all data types in the console to make debugging easier. You can give it direct inputs or have it print variables and results from other functions. It displays as purple in the Debugger |
You may also see the element return "";
. This will return an empty String if there isn’t anything to return. It will only return a String (signified by double quotation marks), not an Integer, Float, Boolean, or Array.
Basic BML Syntax
The basic structure includes statements that comprise the source code and ends with a return statement. The example below shows variables, print statements, and a return statement.
It is considered a best practice to add spaces and comments to your code. This makes the code more readable.
NOTES
Beginning in Oracle CPQ 20A, the BML script compiler is enhanced to automatically utilize StringBuilders during the internal processing of BML functions. This can result in a larger compiled script size. During internal processing, a BML script size limit is enforced. This may affect users attempting to update functions depending on the implementation of their site. If you want to learn more or disable the BML complier optimization enhancement, submit a Service Request (SR) on
My Oracle Support
HTML attributes are not able to be set using a BML function.
Related Topics
See Also