Dev Properties

The Dev properties group impacts the OpenL Tablets features and enables system behavior management depending on a property value.

For example, the Scope property defines whether properties are applicable to a particular category of rules or for the module. If Scope is defined as Module, the properties are applied for all tables in the current module. If Scope is defined as Category, use the Category property to specify the exact category to which the property is applicable.

The properties are defined for the ‘Police-Scoring’ category

The properties are defined for the ‘Police-Scoring’ category

The following topics are included in this section:

Dev Properties List

The Dev group properties are listed in the following table:

Property Name to be used
in rule tables
Type Table type Level at which property
can be defined
Description
ID id String Decision Table,
Spreadsheet
Table Unique ID to be used for calling a particular table
in a set of overloaded tables without using
business dimension properties.
Note: Constraints for the ID value are the same
as for any OpenL function.
Build Phase buildPhase String All Module, Category, Table Property used to manage dependencies
between build phases.
Note: Reserved for future use.
Validate DT validateDT String Decision Table Module, Category, Table Validation mode for decision tables.
In the wrong case an appropriate warning is issued.
Possible values are as follows:
- On: checks for uncovered and overlapped cases. The check supports conditions that compare an input with whole numbers or with a list of values; a table with another condition, such as a range of decimal numbers, gets a warning that the check is skipped. A table whose inputs take too many values to try them all gets that warning too, instead of keeping the compilation going.
- Off: validation is turned off. This is the default value.
Fail On Miss failOnMiss Boolean Decision Table Module, Category, Table Rule behavior in case no rules were matched:
- If the property is set to TRUE, an error occurs
along with the corresponding explanation.

- If the property is set to FALSE,
the table output is set to NULL.
Scope scope String Properties Module, Category Scope for the Properties table.
Datatype Package datatypePackage String DataType Module, Table Name of the Java package for generating
the data type.
Precision precision String Test Table Module, Category, Table Precision of comparing the returned results
with the expected ones while launching test tables:
a whole number of decimal places from -99 to 99, such as 5,
or of significant figures from 1sf to 99sf, such as 4sf,
or sf for the figures of the expected value.
Auto Type Discovery autoType Boolean Properties
Spreadsheet
Module, Category, Table Auto detection of data type for a value
of the Spreadsheet cell with formula.
The default value is true.
If the value is true, the type can be left undefined.
Concurrent Execution parallel Boolean Decision Table,
Spreadsheet
Module, Category, Table Controls whether to parallel the execution of a rule
when the rule is called for an array instead of a
single value as input parameter.
Default is false.
Calculate All Cells calculateAllCells Boolean Spreadsheet Module, Category, Table Applies to a spreadsheet that returns a particular type.
If true, all cells of the spreadsheet are calculated.
This is the default value.
If false, only the cells required for the result
are calculated.
Empty Result Processing emptyResultProcessing String Decision table Module, Category, Table Identifier of whether to process blank parameter
value cells and return an empty result if found, when
set to RETURN, or ignore and find the first
non-empty result value, when set to SKIP (default).

The following example illustrates how the property emptyResultProcessing works depending on its value when x = 1. The value 1 matches all three rules, and the result of the first rule is empty.

With SKIP, the table ignores the empty result and returns 3, the result of the first rule with a value:

SmartRules Integer codes(Integer x)
properties,emptyResultProcessing,SKIP
X,RESULT,<
---
1-100,,<
1-200,3,<
1-300,4,<

With RETURN, the table returns the empty result of the first rule:

SmartRules Integer codes(Integer x)
properties,emptyResultProcessing,RETURN
X,RESULT,<
---
1-100,,<
1-200,3,<
1-300,4,<
Using the Precision Property in Testing

This section describes how to use the precision property. The property must be used for testing purpose and is only applicable to the test tables.

There are cases when it is impossible or not needed to define the exact numeric value of an expected result in test tables. For example, non-terminating rational numbers such as π (3.1415926535897…) must be approximated so that it can be written in a cell of a table.

The Precision property is used as a measure of accuracy of the expected value to the returned value to a certain precision. Assume the precision of the expected value A is N, and B is the returned value. The expected value A is true only if the difference |A – B| is not greater than 1/10 to the power of N, such as 0.01 for N = 2. For zero and a negative N, the difference must be smaller than that: below 1 for N = 0 and below 100 for N = -2.

It means that if the expected value is close enough to the returned value, the expected value is considered to be true.

A BigDecimal or BigInteger result is compared with all its digits. Without a precision, it must equal the expected value, and with a precision, the difference is computed without rounding. A Double or Float result is compared as a floating-point number, so the difference is computed in binary and can be a little larger than it looks: with N = 1, 0.4 does not match 0.3. Without a precision, such a result may differ from the expected value in its last binary digit.

Arithmetic computes with the decimals the numbers show, so 1.73 * 12 returns 20.76 and 9 / 35 * 7 returns 1.8 exactly. The power operator and the math functions compute in binary, though. For example, 1.1 ** 2 returns 1.2100000000000002, which differs from 1.21 by one unit in the last place (ULP) and passes without a precision. However, 1.1 ** 3 returns 1.3310000000000004, which differs from 1.331 by two ULPs and fails without a precision. Set precision to 5 or to 4sf for the second expected result to accept this difference.

A precision written as Nsf, such as 4sf, counts significant figures instead of decimal places. The returned value and the expected value are both rounded half up at the N-th significant figure of the expected value, and they must be equal. With 4sf, 99.00 matches 98.995 and 99.0049, but not 99.005, which rounds to 99.01. The rounding follows the size of the number, so one such precision suits both 1.331 and 1.331E-6, while a decimal precision that suits 1.331 accepts almost any value near 1.331E-6. With 2sf, 11 matches 10.648 and 11000 matches 10648.

The precision sf without a number takes the significant figures the expected value is written with, so each expected value sets its own rounding:

Expected value Figures Returned value Result
10.00 4 10.004 Passed
10.000 5 10.004 Failed
0.0001 1 0.00006 Passed
0.0001 1 0.00004 Failed
99.00 4 99.005 Failed
  • A cell holding text is read as it is typed, and a cell holding a number as its number format shows it: 10 formatted with 0.00 reads 10.00. What the format adds around the number, such as a currency, a unit or the parentheses of a negative number, is skipped: $#,##0.00 shows $10.00, which reads 10.00, and "CO2: "0.00 shows CO2: 10.00, which reads 10.00 too. Grouping commas are skipped, a percent is a hundredth, and an exponent keeps the figures of its mantissa: 1.00E+03 has three figures. A K, M or B typed after a number keeps the figures of that number: 1.5K is 1500 written to the hundreds, so it matches from 1450 up to, but not including, 1550. A format that shows thousands keeps the place of the figures in the value: 0.00, shows 1234.5 as 1.23, whose last figure is the tens.
  • A number cell in the General format, which shows no more figures than the number has, and a cell that holds more than one number, such as an array, are read as the number they hold: every digit of a whole number counts, and a fraction has the digits of its shortest form.
  • A number cell in a fraction format, such as # ?/?, rounds to the parts of the denominator it shows, as a decimal rounds at its last figure. 12 36/100 rounds as 12.36 does: it matches from 12.355 up to, but not including, 12.365. 1 1/2 matches from 1.25 up to 1.75, and a whole number shown without a fraction, such as 2, from 1.5 up to 2.5. A format with a fixed denominator, such as # ?/16, keeps it for every value: 2 matches from 1 31/32 up to 2 1/32 there. Only the section of the format that shows the value counts: 0.00;# ?/16 shows 1.25 to hundredths, and -1.25 to sixteenths.
  • The numbers are compared as decimals, with all the digits they show, so a BigDecimal or BigInteger value keeps all its digits. With Nsf, only zero matches an expected zero.
  • A half rounds away from zero: -99.005 rounds to -99.01.
  • NaN matches NaN, and an infinity matches the same infinity only.

Consider the following examples. A simple rule FinRatioWeight has two tests, FinRatioWeightTest1 and FinRatioWeightTest2:

An example of Simple Rule

An example of Simple Rule

The first test table has the Precision property defined with value 5:

An Example of Test table with Precision Dev property

An Example of Test table with Precision Dev property

An example of Test with precision defined

An example of Test with precision defined

When this test is launched, the first test case is passed because |0.11121358 - 0.111207645| = 0.5935*10-5 < 0.00001; but the second is failed because |0.05410091 - 0.054117651| = 1.6741*10-5 > 0.00001.

OpenL Tablets allows specifying precision for a particular column which contains expected result values using the following syntax:

  _res_ (N)
  _res_.$<ColumnName>$<RowName> (N)
  _res_.<attribute name> (N)
  _res_ (Nsf)
  _res_ (sf)

An example of the table using shortcut definition is as follows.

Example of using shortcut definition of Precision Property

Example of using shortcut definition of Precision Property

An example of Test with precision for the column defined

An example of Test with precision for the column defined

Precision property shortcut definition is required when results of the whole test are considered with one level of rounding, and some expected result columns are rounded to another number of figures to the right of a decimal point.

Precision defined for the column has higher priority than precision defined at the table level.

A column of an array result, such as _res_ (5) for a rule returning Double[], compares each element with the precision of the column: the expected 1.331,2 matches 1.331004 and 2.

Precision is a whole number of decimal places from -99 to 99, zero and negative values included. A precision in significant figures is sf, or a whole number from 1 to 99 followed by sf without a space. A test table with a precision outside these limits, such as 100 or 100sf, does not compile. The error of a column precision names the limits.