One of the complexities of Maximo and BIRT is the fact that you can get the same task accomplished multiple ways. Think about how many ways a work order can be generated. The same can be said with how many ways a report writer can present information in a report. I was recently asked the following:
@mygeekdaddy Have you a way to disp JPtask LD on WOPRINT? LOJ on LD worked in JPdetails but not in woprint. Thx.
— scottegiles (@scottegiles) July 25, 2013
I replied back that two quick ways was to either do a sub-select on the dataset for the long description[1] of the job task or add a new dataset and nest that as a sub-table in the Job Task.[2] Using the out of the box woprint.rptdesign report, I’ll show a couple of ways a report writer can get the long description of a Job Task from the JOBPLANS table.
Out of the box taskDataSet
Before getting started, let’s take a look at the default query used in the open method in the taskDataSet of the woprint.rptdesign file.
sqlText = “select workorder.taskid, workorder.description, workorder.status, woactivity.pointnum, ”
+ “workorder.measurementvalue, workorder.measuredate, workorder.observation ”
+ “from workorder left outer join ”
+ “woactivity on workorder.wonum = woactivity.wonum and workorder.siteid = woactivity.siteid ” + “where workorder.parent = ‘“ + rows[0][“wonum”].replace(/’/g,”’‘“) + ”’ and workorder.istask = 1 and workorder.siteid = ‘“
+ rows[0][“siteid”] + ”’”
+ “ order by workorder.taskid”
When a job plan is either directly inserted into a work order, or used in the PM WOGen process, the job tasks on the job plan become the work tasks on the main work order. So one way we can think about this is:
jobptask.jptask = workorder.taskid
For example, a sample WO has the following tasks:
Note these are the same as the job tasks of the job plan that was directly copied over:
Maximo actually does copy the long description text of the job task to the work order task, we just have to make it visible. Here’s a couple of ways to do this.
Sub-Select on taskDataSet
The easiest method would be to do a sub-select in the taskDataSet.
sqlText = "select workorder.taskid, workorder.description, workorder.status, woactivity.pointnum, "
+ " workorder.measurementvalue, workorder.measuredate, workorder.observation, "
+ " (select ldtext from longdescription where ldownertable='workorder' and ldkey=workorder.workorderid) as ldtext "
+ " from workorder "
+ " left outer join woactivity on workorder.wonum = woactivity.wonum and workorder.siteid = woactivity.siteid "
+ " where workorder.parent = '" + rows[0]["wonum"].replace(/'/g,"''") + "'"
+ " and workorder.istask = 1 "
+ " and workorder.siteid = '" + rows[0]["siteid"] + "'"
+ " order by workorder.taskid"
The 1:1 relationship of ldkey=workorder.workorderid
works because the selected records are the work order task records via the selection:
+ " where workorder.parent = '" + rows[0]["wonum"].replace(/'/g,"''") + "'"
With the query update to the open method complete, modify the fetch method to include the long description by adding the following line:
row["ldtext"] = taskDataSet.getString("ldtext");
Now the fetch method will pull the long description as part of the selection query. Last, add the ldtext
field to output columns list.
Now the add the field into the report and the long description of the job task will print on the work order.
Include Long Description in taskDataSet
The next method would be to include the ldtext field from the LONGDESCRIPTION table directly into the open method selection query.
sqlText = "select workorder.taskid, workorder.description, workorder.status, woactivity.pointnum, "
+ " workorder.measurementvalue, workorder.measuredate, workorder.observation, longdescription.ldtext "
+ " from workorder "
+ " left outer join woactivity on workorder.wonum = woactivity.wonum and workorder.siteid = woactivity.siteid "
+ " left outer join longdescription on longdescription.ldownertable='WORKORDER' and longdescription.ldownercol='DESCRIPTION' "
+ " and longdescription.ldkey=workorder.workorderid "
+ " where workorder.parent = '" + rows[0]["wonum"].replace(/'/g,"''") + "'"
+ " and workorder.istask = 1 "
+ " and workorder.siteid = '" + rows[0]["siteid"] + "'"
+ " order by workorder.taskid"
Follow the same steps in the previous method to add the ldtext
field to the report.
Add Long Description DataSet
The last way [3] would be to add a brand new dataset to the report to display the long description of the of the work order tasks, similar to how the taskDataSet was created for the overall report. While this is a viable option, based on the simplicity of the first two solutions, most report writers would opt to modify the open method to pull the long description into the report.
Conclusion
Like a lot of things in Maximo, there is more than one way to get something done. So no one should be surprised the same thing happens in BIRT. Over the next couple of posts I’ll continue to explore some common report writing methods that have multiple ways to get the end goal accomplished.
A copy of the modified woprint.rptdesign file can be found here.
Got any questions? Feel free to hit me up on Twitter at @MyGeekDaddy.
- That’s the easy way. ↩