Markers

image_pdfimage_print

Related links: Working with Business Rules, Rule Engines and Algorithms

Markers are labels in rules. They are used to process performance-critical rules preferentially. In Jedox, markers are defined within the rule.

In the default configuration of the Jedox In-Memory DB engine, markers are just hints for the engine. They can be ignored for trivial rules that can be processed using a Data-Driven Engine (DDE).

Markers can be defined for any type of rules (B:, C:, or general).

Markers are typically used to define rules for large target areas consisting of millions of cells and more, as is the case when target areas cannot be reduced sufficiently. Then markers can be used to mark in the target area only cells that make sense to calculate.

Markers Definition

Usually, a B: Rule is defined as follows:

['Turnover'] = B: ABS(['Quantity'] * ['Price'])

If one of the source areas involved is labeled with a marker, a pair of double braces “[[” “]]” is used instead of single braces “[” “]”. If “Quantity” should get a marker, you must write:

['Turnover'] = B: ABS([['Quantity']] * ['Price'])

This defines a marker from [‘Quantity’] to [‘Turnover’]. This means that the value [‘turnover’] is calculated only for those basic cells where the value of [‘quantity’] is not 0. (This makes sense since with a quantity of 0 the turnover will also be 0).

Occasionally, more dimensions are specified in the marker than in the target area:

['2013', 'Turnover'] = B: [['2011','Turnover','Cola']] + ['2012','Turnover']

In this case, the marker will be restricted correspondingly, i.e. from [‘2011’, ‘Turnover’, ‘Cola’] to [‘2013′,’Turnover’,’Cola’].

It is possible to define several markers:

['2013','Turnover'] = B: [['2011','Turnover']] + [['2012','Turnover']]

In this case, two markers are defined. One marker from [‘2011′,’Turnover’] to [‘2013′,’Turnover’] and one marker from [‘2012′,’Turnover’] to [‘2013′,’Turnover’]. In this case, the rule is calculated only if at least one of the marked arguments on the right side differs from 0.

It is also possible to define markers for entire cubes. In the simplest case, both cubes have the same dimensions:

['2013','Turnover'] = B: PALO.MARKER("Database","Planning-cube","2012","Turnover")

In this case, a marker from [‘2012′,’Turnover’] in the planning cube to [‘2013′,’Turnover’] is defined. If the marker cube has additional dimensions, these have to be specified with constants.

Below is an example with the name of the planner, Mr. Miller:

['2013','Turnover'] = B: PALO.MARKER("Database","Planning-cube","Mr. Miller","2012","Turnover")

It defines the marker from [‘Mr. Miller’, ‘2012’, ‘Turnover’] in the planning cube to [‘2013′,’Turnover’].

If the marker cube has fewer dimensions than the target cube, the target area can be specified without any restrictions, or it can be restricted by specifying a base element:

['Turnover'] = B: PALO.MARKER("Database","Planning-cube","Mr. Miller","Turnover")

or

['2013','Turnover'] = B: PALO.MARKER("Database","Planning-cube","Mr. Miller","Turnover")

Advantages of Markers

Defining markers significantly reduces the number of calculated cells. If the markers are defined correctly, the results are identical to rules without markers, but the calculation is significantly faster.

Accelerated calculation of marker rules is achieved only when these rules are calculated based only on cells whose value is not 0 (zero). All the basic cells with a value of 0 will be ignored. The result is a massive acceleration, but also the following restriction: for correct results, markers may only be used on rules that always result in 0 when all marked arguments have the value 0.

Arguments of PALO.MARKER()

Only constants and variables can be used as arguments for PALO.MARKER(). General expressions are not allowed.

Example:

['2013','Turnover'] = B: IF (['Price']>10, PALO.MARKER(…) * 2, PALO.MARKER(…) * 3)

This is allowed because the IF expression does not occur in the argument of the marker.

['2013','Turnover'] = B: PALO.MARKER(…, IF (['Price'] > 10,"2012","2011"),"Turnover")

This is not allowed, because the IF expression occurs in the argument of the marker.

Markers for expressions: indirect markers

If you wish to mark expressions (formulas/functions), you can define indirect markers by appending “@” PALO.MARKER() to a formula with PALO.DATA().

For example:

['2013', 'Turnover'] = B: PALO.DATA("Database","Planning-cube",MID(!'Year',1,4),"Turnover")

Here you can define a marker as follows:

['2013', 'Turnover'] = B: PALO.DATA("Database","Planning-cube",MID(!'Year',1,4),"Turnover")@PALO.MARKER("Database","Planning-cube","AllYears%","Turnover")

In this case, a marker from [all children of ‘AllYears%’, ‘Turnover’] of the planning-cube to [‘2013′,’Turnover’] is defined.

Markers for STET() function

Jedox In-Memory DB supports syntax for the STET() function. You can use a shorter version similar to cell reference with empty restrictions:[ ] To define a marked version of STET() you can change it in the same way you would for cell reference. Just double the square brackets: [[ ]]

Old syntax STET() and STET() @ [[ ]] are still supported.

['2010']=B:STET()@[[ ]] ['2010']=B: [[ ]]

['2010']=B:STET()
['2010']=B: []

Rules in pairs, as shown above, are always identical.

Engine Configuration for Marker usage

The long-term goal is to eliminate the need for markers in rule definitions completely. However, for some models built with older Jedox versions, it can still be required to calculate with the Marker-based rule engines. As described in the  Rule Engines article Jedox In-Memory Database Server provides a way to configure engines and control individual features. This also allows the calculation of rules to be enforced in “legacy” fashion, using the older default Marker engine:

engine-configuration MS

For many simple rules, markers are not needed. The OLAP Engine prefers DDE on all compliant rules and ignores the fact that a rule has defined markers. This behavior can be overridden by switch code M.

The current version of Jedox In-Memory Database Server uses the Dynamic Marker Driven Engine. It doesn’t cache all the marked cells in memory and doesn’t have to rebuild the cache every time a rule changes. In some situations, however, dynamic marker processing can also be slower—mainly when processing indirect markers on aggregated cells.

To switch back to static marker processing, add the switch code S and restart the OLAP Server. To make sure the rules are valid, check Rule Engines and Algorithms .

Note: If you change the dimension where a marker is used in the Static Marker-Driven Engine, the markers are not refreshed. Switch to the new Reduced Marker Cleaning Engine or use the API function /database/rebuild_markers to refresh them.

image_pdfimage_print