Running an SQR from a Screen Button
The Maximo screens were built with four hidden, user-definable buttons, named pbUser1 through pbUser4. For this example, we'll set up pbUser1 on the Quick Reporting screen, to invoke an SQR named 'TEST.SQR', passing it the "default" parameters plus the currently displayed WONUM.
- Using Centura Object Nationalizer, edit the screen file to make pbUser1 visible
- In the Hyperlink module, create a record as follows:
Settings Maximo Application QUICKREP Application Tab MAINSCREEN Object pbUser1 Object Type Push Button Hyperlink Type User Application Application to Launch x:\path\test.cmd Parameters Default Parameters checked User Defined Parameters checked fWONUM - Create a command file, we'll call it x:\path\test.cmd, containing:
@ECHO OFF CLS ECHO Parameter 1 is %1 ECHO Parameter 2 is %2 ECHO Parameter 3 is %3 ECHO Parameter 4 is %4 ECHO Parameter 5 is %5 ECHO Parameter 6 is %6 REM START x:\path\sqrw x:\path\test.sqr %1/%2/%3 %4 %5 %6 PAUSE
replacing x:\path\ with the path to your SQR engine and report files. Notice that we have included some debugging lines to show us the parameters that are being passed and that the line that will call the SQR is presently REMmed out. We'll modify that once we've verified that the parameters are getting passed correctly. Note that in this example, the SQR will be accessing the database (%1) as user "maximo" (%2). If we wanted to have it access the database as the current user, the command line would be:REM START x:\path\sqrw x:\path\test.sqr %1/%4/%5 %4 %5 %6
Whether to have the SQR login as "maximo" or the userid depends on the situation. While it is moot that one should never use such a powerful userid for running reports, you may find that there are scenarions where the benefits outweigh the risk. At any rate, note that both passwords are passed in the clear and that a malfunctioning batch file, or the debugging lines left enabled in this example, would cause them to be displayed on the workstation. - Test the Hyperlink by logging into Maximo with your userid, going to the Quick Reporting screen, typing a work order number in the WONUM field and clicking on the new button. You should see a command session open and the passed parameters echoed.
-
If the parameters were correctly passed, edit TEST.CMD to disable the debugging lines and enable the
line that will call the SQR:
@ECHO OFF CLS REM ECHO Parameter 1 is %1 REM ECHO Parameter 2 is %2 REM ECHO Parameter 3 is %3 REM ECHO Parameter 4 is %4 REM ECHO Parameter 5 is %5 REM ECHO Parameter 6 is %6 START x:\path\sqrw x:\path\test.sqr %1/%2/%3 %4 %5 %6 REM PAUSE
Since we selected the "default" parameters and added one "user defined" parameter, the parameters that will be passed to the application are:
Default Parameters | |
%1 | current database |
%2 | "maximo" system userid |
%3 | "maximo" system userid password |
%4 | currently logged in userid |
%5 | currently logged in userid password |
User Defined Parameters | |
%6 | current WONUM |