In reporting context, many times we come across a need where we generate report once, but render dynamically based on user request. One the example is sales reports for past months. They will be generated once, but user would like to see report based on the need. We simply call this functionality as, ‘Render a static file from Pentaho User Console’
Scope of this Article:
This article describes you the steps to Render a static file in Pentaho User Console and it also covers steps to open specific files based on logged in user.
- Pentaho Design studio 3.7.0 or above
We have taken example of calling a static ‘Transaction Summary’ report from xaction.
Detail and Code changes:
- Create a new folder MR(Monthly Reports) under BI server/tomcat/webapps/
- Move Static file to this folder (Transaction_Summary.xls) /MR/ Transaction_Summary.xls
- Now create a simple xaction to call a static file. Create a input string named url ,pass the path of file as the default valueAs shown in screen shots. Do not add any Source of Input
- As we are going to call a static file, we need not add any process actions.
- Add url as output , Destination as response and Name as redirect.
- Save action and now we are ready to open a static file from Pentaho User Console.
- Refresh solution directory and Click on Displayfile under Test directory
- Now let us make a change to render a different file based on logged in user. Open Xaction again.
- Add userid as string and assign 1 as default value, Origin as request in source of input
- NowAs we need to process our xaction to get static report based on passing userid, we need to add filter under process action step,Add users under Prompt for tab and select prompt style as Text Box
- Add java script step under Process Action; Add userid under ScriptInputs , Add val in Script outputs , type as String This step Will pass selected userid into URL , Refer the java script In Screenshot .
- Add val in Process outputs step and output destination as shown below
- Refresh solution Repository and execute xaction By default it will display ‘1’ , as we have assigned It in step 1.
- I am passing a userid as 437 and press OK . Finally we got File, based on Passed userid.
In this article you saw steps to do to Render static file from PUC’. Hope you enjoyed reading this article.
Walking Tree promotes Pentaho and we support the corporates as well as the developers to ensure that the business is able to take complete advantage of Pentaho’s wonderful capability. In case you are looking for a professional assistance then do visit our website to get in touch with us.