Using "where" parameter returns results in Preview, no results in Maximo

Options
megandaisy
edited February 11, 2022 in Analytics #1
<p>I am using BIRT Report Designer 2.3.2 and Maximo 7.1. I created a report for work orders. When I run the report in Preview, or without the Maximo where clause the report runs perfectly. As soon as I add the maximo where parameter I get no results.  I have attached the report. I added the where parameter (not copied) and the report runs fine in Maximo when I leave the where parameter out. Any ideas? </p>

Comments

  • <p>Try adding a space before the last 'and' in the main data set  open script</p>
  • <p>I added the space and I still get no results. </p>
  • <p>What do you mean you added the where parameter?</p>
  • <p>Theoretically, the where parameter can have something like workorder.siteid=..., so if you have an alias for the workorder table it will fail. You can try to replace "workorder." to "wo." inside where parameter first. Or get rid of "wo." in the query.</p>
  • <p>Like</p>
    <p>params["where"].replace("workorder.","wo.");</p>
    <p> </p>
    <p> </p>
    <p>to get a log of your report and view your SQL statement, uncomment the last two lines.</p>
    <p>This is in the initalize method.</p>
    <p> </p>
    <p>importPackage(Packages.com.ibm.tivoli.maximo.report.script);<br>
    mxReportScriptContext = MXReportScriptContext.initialize(reportContext);<br>
    //mxReportScriptContext.setDefaultLogLevel("DEBUG");<br>
     //mxReportScriptContext.setDefaultLogFile("c:/temp/myreport.log");<br>
     </p>
  • <p>A couple of items I noticed:</p>
    <p> </p>
    <p>1. The subreport dataset for WPLaborDataSet is using an incorrect where clause:</p>
    <pre class="_prettyXprint">
    + "where wo.wonum = '" + inputParams["parentwo"] + "'"
    </pre>
    <p>But no where in the select statement is referenced the WORKORDER table or aliasing a table to "WO".</p>
    <p> </p>
    <p>2. The subreport datasets are not linked properly to the main dataset in the where clause. For example, the ChildWorkOrderDataSet uses the following where clause:</p>
    <pre class="_prettyXprint">
    + " where parent.wonum = '" + inputparams["parentwo"] + "' "
    </pre>
    <p>But at no point is a parameter declared for "parentwo". The code that would probably work better is to pull the selected work order from the main dataset:</p>
    <pre class="_prettyXprint">
    + "where parent.wonum = '" + rows[0]["wonum"] + "'"
    </pre>
    <p>3. The Fetch method on the mainDataSet uses </p>
    <pre class="_prettyXprint">
    row["wolongdesc"] = mainDataSet.getHtmlString("wolongdesc");
    </pre>
    <p>While I believe that is correct syntax for a BIRT report, I don't believe Maximo will parse that type get method. OOTB Maximo BIRT reports and the training from IBM states a long description should be treated as a normal text box:</p>
    <pre class="_prettyXprint">
    row["wolongdesc"] = mainDataSet.getString("wolongdesc");
    </pre>