MITS Discover has a feature for dynamically showing or hiding dashboard objects based on the results of a conditional statement. It's called "Conditional Containers" and this feature was added in version 12.
This feature allows a dashboard object to display or not, based upon a logic test. An example would be to only show a grid report of sales overrides if a certain cell object value is over a certain percentage.
Using this feature requires understanding of MITS Web Markup Language (MWML), MITS Query Language (MQL), and permissions to manually edit dashboards and scorecards.
This is an advanced feature and should be approached as such. It is intended primarily for the MITS' development teams.
How It Works
There are two components involved with making this feature work. The first is the container object in the MWML and the second is the actual conditional statement.
The logic of object is basically an IF THEN statement. IF the logic of the conditional statement is true, THEN display the object below.
The flow of the object looks like this:
[CONTAINER START]
[LOGIC TEST]
[DASHBOARD OBJECT]
[CONTAINER END]
Here is an example of how that looks.
{CONDITIONAL.CONTAINER SHOULD.RENDER="#{cubeExists("TEST")}"}
{CELL
FLASH='FLASH SALES SALES.M'
HREF='FLASH SALES SALES.M COST.M PROFIT.M UNITS.M GP.PCT.M'
TEXT.BEFORE="Sales MTD : "
TEXT.AFTER=""
}
{CONDITIONAL.CONTAINER.END}
The conditional statement tests for the existence of the hypercube "TEST". If that cube exists in the MITS.SYSTEM account, then the test is true and the cell object from the SALES cube will be displayed. If the hypercube "TEST" does not exist, then the cell object that follows the conditional statement will not be displayed.
This is how the logic of the Conditional Container object works.
Making a Conditional Container
The best method for creating a new conditional container is to use the Conditional Container button while in the Visual Editor of a dashboard or scorecard.
While you can add a new conditional container directly from the manual editor, there are additional considerations in the formatting of the logic test required. If you manually create the container, you'll need to also manually encode the HTML special characters. Our example container would look like this if we were creating it from scratch in the manual edit mode.
{CONDITIONAL.CONTAINER SHOULD.RENDER="#{cubeExists("TEST")}"}
Once you click the button for the new Conditional Container, a new empty container will be added to the dashboard. Once the object is created, will show up on the dashboard as an empty container.
Hover your mouse over the upper right corner of the object and click the gear icon to enter the expression. This is the logic test the container will apply to determine if the contained object should display.
The syntax for the expressions is listed below.
Enter your expression and click the OK button. This will create the conditional test and container.
From here, you'll need to move to the MWML mode by clicking the Manual Edit button in the menu bar.
Once in the MWML editor, your new dashboard object will look similar to this:
{CONDITIONAL.CONTAINER SHOULD.RENDER="#{cubeExists("TEST")}"}
{CONDITIONAL.CONTAINER.END}
Add the MWML for the object you want to be displayed or hidden based on the results of the conditional test.
In this example, we're choosing to display a cell object based on the existence of the hypercube TEST.
{CONDITIONAL.CONTAINER SHOULD.RENDER="#{cubeExists("TEST")}"}
{CELL
FLASH='FLASH SALES SALES.M'
HREF='FLASH SALES SALES.M COST.M PROFIT.M UNITS.M GP.PCT.M'
TEXT.BEFORE="Sales MTD : "
TEXT.AFTER=""
}
{CONDITIONAL.CONTAINER.END}
The MWML for the object is contained within the conditional container object's code. Notice that the object for the CELL opens using the { and closes using the } inside of the open and close statements of the conditional container.
If you don't know the syntax for the dashboard object, you can create it separately using the Dashboard Object button in the visual edit mode then cut and paste the code in the manual editor.
Syntax
The MEL is based on (and uses) the Java Expression Language (JEL). The specifics of JEL's syntax can be found at the link below as well as in many other resources available in a web search. JEL is not unique to MITS.
http://download.oracle.com/otndocs/jcp/el-3_0-fr-eval-spec/index.html
MEL expressions cannot be nested. That is to say you cannot use a test within a test. Only one logic test per conditional container is allowed. Trying yo use more than one will return an error.
All MEL expressions (the part of the conditional container after the equal sign (=)) must start with either a dollar sign ($) or the pound sign (#), followed by an opening curly brace {. The end of the statement must include a closing curly brace (}).
Testing the Expression
Included with this feature is a button in the menu for testing the results of an expression based on any given MITS Discover user's permissions.
Click the button to bring up the testing window.
The Run-as User menu allows you to select the user whose permissions you want applied when the test is made. This will tell you if the conditional container will display for that user based on security.
In the example above, if the user JEFF didn't have permission on the SALES cube, the results would be false even if the cube was in a reportable state. That would be because without permission to access the SALES cube, the cube is not in a reportable state for that specific user.
The text entry box is where you'll enter the expression to test. All MEL expressions must start with either a dollar sign ($) or the pound sign (#), followed by an opening curly brace {.
Place the expression to test in the text box. In the example, we are testing:
#{cubeReportable("SALES")}
Press the Test button and view the results. Results that are True, will display the object in the conditional container. False results will hide the object in the conditional container.
MITS Specific Expressions
cubeExists
Checks for the existence of a specified cube
#{cubeExists("cube name")}
#{cubeExists("AR")}
cubeReportable
Checks to see if the specified cube is in a reportable state
#{cubeReportable("cube name")}
#{cubeReportable("SALES")}
identExists
Checks for the existence of a specific identifier
#{identExists("cube name")}
#{identExists("AR")}
reportSourceExists
Checks for the existence of a specified cube
#{reportSourceExists("report source name")}
#{reportSourceExists("OPEN.ORDERS.REPORT")}
reportSourceReportable
Checks to see if the specified report source is in a reportable state
#{cubeReportable("report source name")}
#{cubeReportable("SALES")}
userHasRootRestriction
Checks to see if the user has ANY identifier restrictions on the cube.
#{userHasRootRestrictionOnIdent("cube")}
#{userHasRootRestrictionOnIdent("SALES")}
userHasRootRestrictionOnIdent
Checks to see if the user has ANY identifier restrictions on the cube.
#{userHasRootRestrictionOnIdent("cube name","identifier ID")}
#{userHasRootRestrictionOnIdent("SALES","L1")}
cubeHasEon
Checks to see if the eon (time frame) exists
#{cubeHasEon("cube","eon")}
#{cubeHasEon("SALES","M-13")}
evalCellNumeric
Checks to see if a value is above/below a certain threshold
#{evalCellNumeric("FLASH "cube" WITH "identifierID" = 'number' "columnID") > threshold}
#{evalCellNumeric("FLASH AR WITH C = '976' CURRENT.BALANCE.M") > 100}
lowestLevelRowCount
Checks to see if there is one or more rows in a MITS Discover report
#{lowestLevelRowCount("FLASH "cube" "identifierID" ") > 0}
#{lowestLevelRowCount("FLASH OPEN.ORDERS O OPEN.AMT.M") > 0}
rowCount
Checks to see if there is one or more rows in a MITS Report report
#{rowCount("REPORT "report name" FROM "report source name"") > 0}
#{rowCount("REPORT ORDER.NUMBER FROM OPEN.ORDERS.FILE") > 0}
Comments
0 comments
Article is closed for comments.