{"id":5867,"date":"2016-11-09T16:50:36","date_gmt":"2016-11-09T21:50:36","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=5867"},"modified":"2016-11-09T16:50:36","modified_gmt":"2016-11-09T21:50:36","slug":"using-pentaho-business-model-in-a-report","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2016\/11\/09\/using-pentaho-business-model-in-a-report\/","title":{"rendered":"Using Pentaho business model in a report"},"content":{"rendered":"<p>After starting the Pentaho Metadata Editor (MDE), the first thing we should do is configure the model to fetch security information from Active Directory (AD).  This of course assumes that you have configured the Pentaho Server to fetch users from AD.  If so, follow the menu path shown below.  Enter your service URL, needing only to change the hostname where your Pentaho server is located.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5926 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238cd1d3fb2.png' \/><\/p>\n<p>Once you have done this, right click the Connections tree node and click New Connection.  In the example below, we use a JNDI entry for our data source.  This is highly recommended, as it allows you to test against a locally configured data source such as development, and use the exact same configuration in production when pointed to a production data source.  The local data source can be configured in USER_HOME\/.pentaho\/simple-jndi\/default.properties, with an example entry below&#8230;<\/p>\n<pre>\r\narch\/type=javax.sql.DataSource\r\narch\/driver=oracle.jdbc.driver.OracleDriver\r\narch\/user=scott\r\narch\/password=tiger\r\narch\/url=jdbc:oracle:thin:@dbhost:1521\/dbname.domain\r\n<\/pre>\n<p>I you had to add what is above, restart the MDE, then add the connection by right clicking Connections and clicking Add Connection, as suggested above.  You can then enter the values below, changing to suit your environment.<\/p>\n<p><img alt='' cla\nss='alignnone size-full wp-image-5928 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238d1cdae68.png' \/><\/p>\n<p>Right click your newly added connection uder the Connections tree node, and select Import Tables From Explorer.  Select tables as applicable.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5929 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238d574e1f4.png' \/><\/p>\n<p>In our case, we selected EMP and DEPT.  Select Business Models\/New Business Model, and create it changing the name to EMPS.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5930 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238d8c65908.png' \/><\/p>\n<p>Drag and drop the tables under the Connections link to the Business Tables tree node.  Drag and drop the newly created Business Tables to the Business View tree node.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5931 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238df54dc71.png' \/><\/p>\n<p>Click the CTRL key and holding it down while click both the EMP and DEPT tables.  Right click and select Add Relationship, with the values shown below.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5933 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238ed7778e5.png' \/><\/p>\n<p>The Graphical View should now look like what is below.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5934 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238eefc8ae9.png' \/><\/p>\n<p>We can now moving on to enabling row level security.  Double CLick EMPS under the Business Models tree node and select Metadata Security, as shown below.  Under Role Based Constraints, click the + button and select a user to whom you wish to apply row level security.  Add the condition with the format [BUSINESS_TABLE_NAME.COLUMN_ID]=value.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5936 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238f15f416c.png' \/><\/p>\n<p>We then publish the model to our Pentaho server&#8230;<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5938 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58238ff456a21.png' \/><\/p>\n<p>&#8230;and also save the model to a local file.  We will use this in the subsequent report build in Pentaho Report Designer.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5957 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58239227e67c7.png' \/><\/p>\n<p>Start the Pentaho Report Designer (PRD) and select Report Wizard.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5939 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_5823902bd0f28.png' \/><\/p>\n<p>Select a template.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5940 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58239047bac2d.png' \/><\/p>\n<p>Click the + button and select Metadata for the datasource type.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5941 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_582390637d85c.png' \/><\/p>\n<p>Browse for the location in which you saved the MDE model described above.  Type your name domain you used when you created the model.  Click the + button to create a query, select it, then click the pencil icon on the right hand side of the window.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5943 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_5823908581044.png' \/><\/p>\n<p>You should see the two tables from the model we created above and included in this report.  Select the ENAME and SAL columns from the EMP table.  We didn&#8217;t use the DEPT table, but could have if you want to extend the example.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5944 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_582390a84e407.png' \/><\/p>\n<p>Click OK, then Preview on the previous window.  Notice that we see all the records, as the row level security is not applied in preview.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5946 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_582390c33dca6.png' \/><\/p>\n<p>Click through the next screens to take advantage of the wizard.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5947 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_582390db64360.png' \/><\/p>\n<p><img alt='' class='alignnone size-full wp-image-5949 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_5823910347854.png' \/><\/p>\n<p><img alt='' class='alignnone size-full wp-image-5950 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_5823911e3d120.png' \/><\/p>\n<p><img alt='' class='alignnone size-full wp-image-5951 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_5823913d083d7.png' \/><\/p>\n<p>Finally, publish the report to the Pentaho Server&#8230;<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5953 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_58239186eaf40.png' \/><\/p>\n<p><img alt='' class='alignnone size-full wp-image-5954 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_582391a1bc363.png' \/><\/p>\n<p>&#8230;and you should see only the data in your RLS rule, using the data from the Pentaho business model you created.<\/p>\n<p><img alt='' class='alignnone size-full wp-image-5955 ' src='http:\/\/appcrawler.com\/wordpress\/wp-content\/uploads\/2016\/11\/img_582391be588d2.png' \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After starting the Pentaho Metadata Editor (MDE), the first thing we should do is configure the model to fetch security information from Active Directory (AD). This of course assumes that you have configured the Pentaho Server to fetch users from&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2016\/11\/09\/using-pentaho-business-model-in-a-report\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[76,75],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5867"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=5867"}],"version-history":[{"count":28,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5867\/revisions"}],"predecessor-version":[{"id":5974,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5867\/revisions\/5974"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=5867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=5867"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=5867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}