SVS Cube Supervisor
Cube Supervisor
The Cube Supervisor is an SVS worker reacting to changes to cell values. It requires that the Cube worker has been activated by Jedox Support.
Inside the function InitCubeWorker of the file sep.inc.on_cell_change.php, you can define several areas of sets/slices of cells for every cube and link each of these “hot areas” to its own callback PHP function that will be executed if the user changes the value of a cell inside the set. In this scenario, the SVS Cube supervisor is called before the change to the cube cell values (that is, the input made by the user) is applied in the In-Memory database. The callback function, which is initiated in the Supervision Server script, can then execute any custom logic the script defines. Some examples of these custom logics are writing information to files, modifying the values entered by the user, making similar changes in other areas of the cube or In-Memory database, and so on. As a prerequisite, the Cube worker must have been activated by Jedox Support.
If a bulk method is used for setting multiple values at once, such as the PALO.SETDATA_BULK() formula, the SVS event handler is triggered once for each of the cell coordinates in the bulk request that belongs to the cube area monitored by the event handler.
If the change of the value the user originally made should also be applied in the respective cube cell, then this change must also be executed in the defined script itself.
Note: the areas defined in a cube must not overlap structurally. For example, if you define a worker for an area containing Qtr. 1 and another for Jan, the two areas overlap because Qtr. 1 is the parent of Jan. Furthermore, when defining the cube area to be supervised by the SVS in the PHP script, ensure that the elements are always specified as PHP array expressions, even when defining only a single dimension element. Therefore, the correct expression, e.g. for an element named “Actual”, is array('Actual')
and not 'Actual'
. Otherwise, the SVS will not be able to correctly initialize the supervised cube area, resulting in errors when the In-Memory DB service is started.
The splashing parameters of a user's input are also passed to the Supervision Server in the InitCubeWorker event so that they can be handled in the callback function for WatchCubeArea.
Custom error messages
In some cases, such as an SVS cube worker script that supervises changes made in specific cubes or cube areas, the script may refuse the change based on some custom logic in the script. You can enable custom error messages using a sep_error function.
The function sep_error takes two arguments: a message header and a message body. If the message header has a certain content, you can control the look of the message popup in the Excel Add-in or Web. The function uses the following syntax:
sep_error(string title, string message)
String title |
Indicates if a warning, info, or error message is shown. The following values are possible:
|
String message |
The text of the popup message. |
Examples:
sep_error("0 : Custom Info Message", "No one is allowed to modify Turnover values")
Result:
sep_error("1 : Custom Warning", "No one is allowed to modify Turnover values")
sep_error("2 : Custom Error Message", "No one is allowed to modify Turnover values")
If the value of the first argument is, for example, "Warning", a warning message using the same argument as text is shown.
For all the other values of the first arguments of sep_error, the normal writeback error popup message is displayed. The value of the second argument is shown in the detailed error message of the popup.
Note: If you make an actual writeback mistake, such as omitting the # character on an aggregated cell, the SVS script is not reached, and the regular writeback popup message is displayed.
Updated November 4, 2024