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)
property binding
birtprofi
How could I use params in the data set-property binding in the right way?<br />
<br />
I have a DataSet and would like to change the query. If I have the same Params this will no Problem. But actually I use differents params. My report parameters are date parameters<br />
<br />
Could I change the '?' option in the query with the string: params("datefrom") ?<br />
<br />
I had tried this, but than the report got some failures. If I work with the '?' everything is ok. But now I have different report parameters an I couldn?t work with '?'<br />
<br />
what is the correct string for date params?<br />
<br />
<br />
if (params["Monatswechsel"].equals("1")) {<br />
this.queryText = "select m.MA_NAME, ..... <br />
left outer join (select * from AUSGABE where AUS_DATUM = <strong class='bbc'><span class='bbc_underline'>?</span></strong>) as aus on a.AUS_MA_NR = aus.AUS_MA_NR <br />
left outer join (select * from AUSGABE where AUS_DATUM = <span class='bbc_underline'><strong class='bbc'>?</strong></span> and SP83 = 1) as ausg on a.AUS_MA_NR = ausg.AUS_MA_NR where a.AUS_DATUM = ? and a.SP83 = 1 order by 2, 1"; <br />
} else {<br />
var endOfQuery = "";<br />
this.queryText = "select ....<br />
left outer join (select * from AUSGABE where AUS_DATUM = <span class='bbc_underline'><strong class='bbc'>?</strong></span> and SP83 = 1) as aus on a.AUS_MA_NR = aus.AUS_MA_NR where a.AUS_DATUM = <span class='bbc_underline'><strong class='bbc'>?</strong></span> and a.SP83 = 1 order by 2, 1" + endOfQuery;<br />
}
Find more posts tagged with
Comments
Rajesh kmr
you can write a small java script in data set's before open event,that will replace the ? symbol in your data set main query.<br />
<br />
suppose you have a query like this in main data set-<br />
..........<br />
..........<br />
ON "T_SiteEmployee"."EmployeeID"="T_Employee"."EmployeeID"<br />
INNER JOIN T_Team <br />
ON "vw_EmployeeProfile".TeamID = dbo.T_Team.TeamID<br />
INNER JOIN T_SiteEmployeeTeam<br />
ON "T_SiteEmployee".SiteEmployeeID = dbo.T_SiteEmployeeTeam.SiteEmployeeID<br />
WHERE T_SiteEmployeeTeam.IsFloat=1<br />
AND "vw_EmployeeProfile"."SiteID"=? <br />
AND vw_EmployeeProfile.IsActive=?<br />
<br />
<br />
then we can replace the condition with java script <br />
<br />
sn = reportContext.getParameterValue("hrCategoryName");<br />
sn1= reportContext.getParameterValue("teamname");<br />
ssn = "";<br />
ssn1 = "";<br />
for(var i=0;i<sn.length;i++){<br />
ssn+=sn
+"','";<br />
}<br />
ssn=ssn.substring(0,ssn.length-2);<br />
for(var j=0;j<sn1.length;j++){<br />
ssn1+=sn1[j]+"','";<br />
}<br />
ssn1=ssn1.substring(0,ssn1.length-2);<br />
<br />
<br />
qt = this.queryText;<br />
this.queryText = qt.replace("vw_EmployeeProfile.IsActive=?","vw_EmployeeProfile.IsActive=? and vw_EmployeeProfile.TeamName in ('" + ssn1 + ") and vw_EmployeeProfile.HRCategoryName in ('" + ssn + ") ");<br />
<br />
<br />
so in this case you can add your own date and can get the right value.<br />
<br />
revert me back if it working or not.
paulk
You can replace the ? in the property binding.
The ? should be replaced with (including the single quotes): '" + params["datefrom"] + "'
Number parameters don't require the single quotes.
birtprofi
Hi guys,
thanks for your help. I used the suggestion from paulk. Now it works perfect. My failure was, that I did not use the single quotes.
thanks
rafael