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)
Once a parameter always a parameter?
SharonJ
New to BIRT and used my first report to get a handle on groups/headers/subtotals, named expressions, bindings, etc. Thought the 2nd report would be a slam dunk after getting totals & subtotals figured out. Scoured forums, training guides, help files to build & use a paramater (ended up stealing it from the OOB person_details.rptdesign) - it works and I called it and used it in a subdataset. Awesome!
Now, however, I find I need another subdataset for WO material costs and there's no link to the personid parameter I created in the main dataset.
My BIRT PHILOSOPHICAL question is this: Do I have to call on the parameter in every subdataset, or can subdatasets be connected to other subdatasets by calling the 1st sub's primary key row, or can you even USE sub-subdatasets ?
I'm probably going about this totally backwards and need to redesign my maindataset, but I'm afraid to mess with the parameter that works because it took me so long to get there and I really don't have an understanding of how or why it works - just that it does. Would like to keep it that way ;-)
Thanks for any insight on whether it's necessary to call a parameter in every subdataset once established, or if sub's can have other sub's while ignoring the parameter.
Find more posts tagged with
Comments
luananicho
If I understand your question correctly, yes, you can refer to the key field in the primary row. Here's a sample out of one of my reports where I'm getting material costs where the wonum and site are the same as the main data set. Where it says "rows[0]" it's telling it to get the siteid and wonum from the main query.
sqlText = "select workorder.wonum, workorder.taskid, workorder.istask, matusetrans.itemnum, matusetrans.description, "
+ "matusetrans.location, matusetrans.quantity, matusetrans.unitcost, matusetrans.linecost "
+ "from matusetrans, workorder "
+ "where workorder.siteid = '" + rows[0]["siteid"] + "'"
+ "and workorder.wonum = matusetrans.refwo "
+ "and ((workorder.parent = '" + rows[0]["wonum"] + "' and workorder.taskid is not null) "
+ "or (workorder.wonum = '" + rows[0]["wonum"] + "' and workorder.taskid is null)) "
+ "and workorder.siteid = matusetrans.tositeid "
+ "order by workorder.taskid"
;
SharonJ
Thank you so much for your reply! Coincidently, I just lifted this same bit and was trying to work with it becuase it does what I want and I love that you can just copy/paste datasets from other reports with the fetch and output intact. very cool.
If I understand YOU correctly, I don't have to use the parameter in every subdataset, but I DO have to have a reference row in the main data set -- a subdataset's reference can't come from another subdataset. Is that right?
I started from scratch this a.m. trying to get person connected to workorder in the main dataset but I can't seem to get more than one "where" element to work with the parameter and don't know enough about it of course to know if that's a BIRT thing or a "me" thing. Here is what I've been playing with - truly appreciate any help! Like I say, when I un-slash the additional where criterion, I go from perfectly parameterized results to zero results.
maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());
maximoDataSet.open();
var where = params["where"];
if(params["personid"].value) {
where += " and " + MXReportSqlFormat.createParamWhereClause("person.personid", params["personid"]);
}
var sqlText = new String();
// Add query to sqlText variable.
sqlText = "select person.personid, person.displayname, "
+ " workorder.wonum "
+ " from person left outer join workorder on workorder.wolo6 = person.personid"
// Include the Maximo where clause
+ " where " + where
//+ " and istask=0 "
//+ " and historyflag=0 "
//+ " and wolo5=1 "
//+ " and status !='billed'"
;
maximoDataSet.setQuery(sqlText);
luananicho
I'm confused and don't really understand your question. Maybe if you uploaded your report and explained what isn't working, I could help figure out what's wrong. Alternatively, you could e-mail me at luananicholas@bc.com. <br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'SharonJ'" data-cid="67819" data-time="1282842058" data-date="26 August 2010 - 10:00 AM"><p>
Thank you so much for your reply! Coincidently, I just lifted this same bit and was trying to work with it becuase it does what I want and I love that you can just copy/paste datasets from other reports with the fetch and output intact. very cool.<br />
<br />
If I understand YOU correctly, I don't have to use the parameter in every subdataset, but I DO have to have a reference row in the main data set -- a subdataset's reference can't come from another subdataset. Is that right?<br />
<br />
I started from scratch this a.m. trying to get person connected to workorder in the main dataset but I can't seem to get more than one "where" element to work with the parameter and don't know enough about it of course to know if that's a BIRT thing or a "me" thing. Here is what I've been playing with - truly appreciate any help! Like I say, when I un-slash the additional where criterion, I go from perfectly parameterized results to zero results.<br />
<br />
maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());<br />
maximoDataSet.open();<br />
<br />
var where = params["where"];<br />
if(params["personid"].value) {<br />
where += " and " + MXReportSqlFormat.createParamWhereClause("person.personid", params["personid"]);<br />
}<br />
var sqlText = new String();<br />
<br />
// Add query to sqlText variable.<br />
sqlText = "select person.personid, person.displayname, "<br />
+ " workorder.wonum "<br />
+ " from person left outer join workorder on workorder.wolo6 = person.personid"<br />
// Include the Maximo where clause<br />
+ " where " + where<br />
//+ " and istask=0 "<br />
//+ " and historyflag=0 " <br />
//+ " and wolo5=1 "<br />
//+ " and status !='billed'" <br />
;<br />
maximoDataSet.setQuery(sqlText);<br /></p></blockquote>