Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Nested Data Set
drusso17
I am currently writing a "Time Ticket" report for users to be able to print out a summary sheet for a workorder that can be signed by the customer to document work. I have 2 issues:<br />
<br />
First, if I put the report under the Work Order Tracking application, how does Maximo pass the current workorder number (that is being viewed) to the report when they click on the report's Browser View button? Currently I simply hard-coded in a sample workorder number ("BCSD-1") in the mainDataSet's open() method in the SQL clause. I believe it may be passed into the params["where"] perhaps, but I'm not sure.<br />
<br />
Second, I have 2 sections on the report (Labor & Materials) that pull in multiple rows from the labtrans and matusetrans tables (right now only the labtrans one is implemented). I have set up a second data set (laborDataSet) that is supposed to pull in all the labor transactions for the workorder that is specified in the mainDataSet. From reading online, I believe this would be done in the laborDataSet's open() method in the SQL statement such as:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>"SELECT laborcode,"
+" regularhrs,"
+" premiumpayhours,"
+" linecost,"
+" startdate,"
+" starttime"
+" FROM labtrans"
+" WHERE refwo='"+rows[0]["wonum"]+"'";</pre>
*Note the rows[0]["wonum"] part that SHOULD be pulling in the workorder number from the mainDataSet. However, when I look at the debugging information, it is inserting a "null" instead of the current "wonum". <br />
<br />
Any and all help with both of these issues would be greatly appreciated! I have attached the .rptdesign file in a .zip file below.<br />
<br />
Thanks!
Find more posts tagged with
Comments
micajblock
For question 1 - Yes, Maximo passes a parameter name 'where' which contains conditions so that only the current workorder is used.
For question 2 - I would not use a nested dataset, but a subreport. The second query will retrieve all the workorders that the main dataset uses and then I would use a subreport like this.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/530-sample-birt-sub-report-example/
Another option is to use a Joined dataset.
paulk
Setup a parameter named 'where' in the report design. Use params["where"] in the query for the Workorder dataset. Example: "SELECT * FROM workorder where " + params["where"]
The Labor and Materials tables should be inside the Workorder table. You need to use inputParams["param1"] instead of rows[0]["wonum"] in the query. Right click on the dataset and go to edit. Go to the Parameters option and create a new parameter called param1. Select the subtable in your report, go to the Binding tab of the Property Editor. Click the Dataset Parameter Binding... button. Set the value of param1 here to row["wonum"]. Now you have a subtable that only shows labor/material records for that workorder.
param1 can be any name you choose. You can setup multiple parameters this way, just give each a unique name.
drusso17
Thanks for the help! I was able to circumvent the problem completely by just using the same where clause for each and rearranging the SQL a little bit. I am however running into a new problem. How can I use the currently logged in user's ID within the SQL query?
micajblock
Which user? Maximo or iServer?
drusso17
<blockquote class='ipsBlockquote' data-author="'mblock'" data-cid="79789" data-time="1310076567" data-date="07 July 2011 - 03:09 PM"><p>
Which user? Maximo or iServer?<br /></p></blockquote>
<br />
Maximo username
micajblock
<blockquote class='ipsBlockquote' data-author="'drusso17'" data-cid="79814" data-time="1310130184" data-date="08 July 2011 - 06:03 AM"><p>
Maximo username<br /></p></blockquote>
<br />
As far as I know Maximo does not pass the current user name to the report, so I do not think this is possible.