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)
Inserting Input Paramaters in Dataset within BIRT
warren_marsha@hotmail.com
<p>Hi All,</p>
<p> </p>
<p>I'm using Oracle...</p>
<p> </p>
<p>I have a dataset that requires capturing data for the previous month.</p>
<p> </p>
<p>The user can enter current month, Month = 01 and Year = 2016, as input parameters.</p>
<p> </p>
<p>I'd like to be able to take the input from the user and convert the string values to to_date(input parameters, 'MM/YYYY'), but I don't believe I'm using the correct syntax.</p>
<p> </p>
<p>Within my dataset I currently have ...</p>
<p>where date_field < to_date(' " + params[Month] || '/' || params[Year] + " ', 'MM/YYYY')</p>
<p> </p>
<p>Is this the correct syntax for concatenating the input parameters and formatting them as dates ?</p>
<p> </p>
<p>Thanks</p>
Find more posts tagged with
Comments
micajblock
<p>What database are you using? What version of BIRT?</p>
<p> </p>
<p>Also month/year is not a date.</p>
warren_marsha@hotmail.com
<p>I'm using Oracle.</p>
<p> </p>
<p>BIRT version 2.5.2</p>
<p> </p>
<p>Correct... Month/Year is not a date. I need to convert the input string value params[Month] = '01' and params[Year]='2016' to a to_date format of 'MM/YYYY', because I need to compare the values to a date value.</p>
<p> </p>
<p>I need to know what the syntax is for using input parameters in the datasets within BIRT.</p>
<p> </p>
<p>I currently have ... where date_field < to_date(' " + params[Month] || '/' params + " ', 'MM/YYYY')</p>
<p> </p>
<p>Is this correct syntax if I place it in my dataset within BIRT?</p>
<p> </p>
<p>Thanks</p>
micajblock
<blockquote class="ipsBlockquote" data-author="warren_marsha@hotmail.com" data-cid="144693" data-time="1469132661">
<div>
<p><span style="font-size:12px;">Is this correct syntax if I place it in my dataset within BIRT?</span></p>
</div>
</blockquote>
<p>No, the syntax is not correct, nor would I do it that way. In the data set I would have:</p>
<pre class="_prettyXprint">
where year(date_field) = ? and month(date_field) = ?</pre>
<p>and then I would bind the report parameters to the SQL parameters. This is the optimal way to pass parameters to reports as it avoids SQL injection. See picture (as I do not have the same version as you there might be some differences).</p>