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)
BIRT Parameters - Named
georgeslteif
<p>Hello</p><p>i am creating a BIRT report where i want to use 2 parameters for 3 union select statements.</p><p>EX:</p><p>select * ......... where office_id=? and loan_officer_id=?</p><p>union</p><p>select * ......... where office_id=? and loan_officer_id=?</p><p>union</p><p>select * ......... where office_id=? and loan_officer_id=?</p><p> </p><p>usually i used to create 6 params to map these parameters even though they are only 2 parameters the office_ID and loan_officer_id</p><p>i am new to the scripting part of BIRT, is there a way to use the beforeopen in BIRT and have the same query written but with named parameters? like officeID and loanofficerID as parameters?</p><p>and how to map them?</p><p> </p><p>thanks</p><p> </p>
Find more posts tagged with
Comments
Sandeep_A
<div>In the query, replace ? with a string:</div><div> </div><div>e.g:</div><div> </div><div><p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">select * ......... where office_id='pOfficeId' and loan_officer_id='pLoanOfficer'</p><p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">union</p><p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">select * ......... where office_id='pOfficeId' and loan_officer_id='pLoanOfficer'</p><p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">union</p><p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">select * ......... where office_id='pOfficeId' and loan_officer_id='pLoanOfficer'</p></div><div> </div><div>Now, In the beforeOpen of the Data Set, use this:</div><div>this.queryText = this.queryText.replace([color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;]'pOfficeId'[/color],params["officeId"].value);</div><div>this.queryText = this.queryText.replace('[color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;]pLoanOfficer[/color]',params["[color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;]loanofficerID[/color]"].value);</div><div> </div><div>If you have different parameter names, rename 'officeId' and '[color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;]loanofficerID[/color]' in the params["..."].value section.</div>