The purpose of FlexRules is to offer simple customization of how ROB-EX Scheduler behaves or how information is shown to the user.
Currently FlexRules may be used to
- Create new columns (layout items) that any user may add to standard ROB-EX Scheduler tables.
- Dynamically exclude individual resource alternatives for selected resource/operation combinations whenever ROB-EX Scheduler business rules needs to assign operations to resources.
Facts about FlexRules
- consists of a name and then code (expressions) being evaluated during the execution of standard ROB-EX Scheduler business rules. An expression takes some input, like an operation or order, and produces a return value as output. The return value is evaluated and used by internal ROB-EX Scheduler business rules.
- is saved and loaded with your plan.
- On Multiuser Server FlexRules are loaded when you login.
- If you run as single user, FlexRules are loaded when you load your planning xml file.
- is active as soon as it has been created, i.e. business rules will start to evaluate against the FlexRule as soon as it exist
FlexRule vs Flex expression
A Flex expression is a single code line that takes a base model object (Operation, Order, etc.) and returns some value. The language used in a Flex expression is based on the SpEL language, furhter explained in the next chapters. As an example, an expression formatting the workload of an operation as hours and minutes would look like (the keyword
input corresponds to an Operation in this case):
input.workload.intValue() + ":" + (input.workload * 60 % 60).intValue()
A FlexRule is a collection of one or more expressions. A rule used for layout items would only consist of a single expression. A rule to exclude resources from operations takes two expression (the first expression determines which operations the rule applies to, the second which resources to exclude as possibilities).
Having some basic coding background will help you when editing code expressions.
Different kinds of FlexRules
FlexRules can be divided into two main categories
- Visual FlexRules: changes how and what information is shown on the users Desktop version of ROB-EX Scheduler client
- Behavioral FlexRules: changes how the ROB-EX Scheduler business rules behaves
The next chapters contains detailed information about each of the different FlexRule categories.
Create or edit FlexRule
To get started, navigate to “Functions ->FlexRules” – a new dialog opens up, showing a table overview of all created FlexRules. Initially this table will be empty.
Clicking on any of the add buttons (e.g. “Add layout item”) opens a FlexRule editor with one or more Flex Expressions. the Flex Rule can be given a name, a description and a priority. Priorities are not relevant for all types of FlexRules. When relevant, then expressions are evaluated with low priority values being evaluated before high priority values.
Editing Flex Expression
Each Flex expression area has 2 options.
- Input: what type of basemodel object the expression expects as input (e.g. OperationAndResource, Resource, Operation etc.).
- Output: what type of object the expression evaluates to (Numbers, text, true/false values, etc.).
Choose input and output types (might be fixed, depending of your choice of FlexRule). Enter a description for the expression section.
The expression section contains two textareas – one for the expression code itself and one for the test output.
- The expression textarea already contains an example expressions. Above the expression textarea you will find a dropdown with additional examples of expressions. Open the dropdown and choose the examples you would like to use. You can also just type in your own expression in the textarea.
- Click the Test button to test your expression code. The operation you currently have selected in the ROB-EX Scheduler Gantt chart, is used as input of the test (if your expression takes a Resource as input, the system will automatically use the selected resource of the operation as the input). The result of the test will be shown in the textarea to the right. Errors will be shown in red.