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)
Seeting up Parameter for String value
info_js
Hello,<br />
<br />
I am very new to BIRT report design. I created a Data set query something like this:<br />
<br />
<strong class='bbc'>select * from table_name;</strong><br />
<br />
I was able to see the data in the Preview Results. Then I wanted to set up a parameter just to pull one row of data.<br />
<br />
First, I tried without setting up the parameter, something like this:<br />
<br />
<strong class='bbc'>select * from table_name where colname like('string_value')</strong><br />
The colname is of the type string. I was able to view that particular row in the preview result. Now, when I try to set up a parameter, I get an error:<br />
<br />
The query I am trying to run is:<br />
<strong class='bbc'>select * from table_name where colname like('?')</strong><br />
Set up a parameter, selected 'String' as the data type and gave a default value that worked, but I am getting an error!<br />
<br />
I tried changing the query to <br />
<br />
<strong class='bbc'>select * from table_name where colname like(?)</strong><br />
then to:<br />
<strong class='bbc'>select * from table_name where colname like ?</strong><br />
<br />
The following are the error messages I get<br />
<br />
at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:96)<br />
at org.mozilla.javascript.Parser.addError(Parser.java:146)<br />
at org.mozilla.javascript.Parser.reportError(Parser.java:160)<br />
at org.mozilla.javascript.Parser.statementHelper(Parser.java:1266)<br />
at org.mozilla.javascript.Parser.statement(Parser.java:707)<br />
at org.mozilla.javascript.Parser.parse(Parser.java:401)<br />
at org.mozilla.javascript.Parser.parse(Parser.java:338)<br />
at org.mozilla.javascript.Context.compileImpl(Context.java:2368)<br />
at org.mozilla.javascript.Context.compileString(Context.java:1359)<br />
at org.mozilla.javascript.Context.compileString(Context.java:1348)<br />
at org.eclipse.birt.report.engine.javascript.JavascriptEngine$3.run(JavascriptEngine.java:240)<br />
at org.eclipse.birt.report.engine.javascript.JavascriptEngine$3.run(JavascriptEngine.java:1)<br />
at java.security.AccessController.doPrivileged(Native Method)<br />
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.compile(JavascriptEngine.java:236)<br />
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.compile(JavascriptEngine.java:1)<br />
at org.eclipse.birt.core.script.ScriptContext.compile(ScriptContext.java:148)<br />
at org.eclipse.birt.data.engine.impl.ParameterUtil.evaluateInputParameterValue(ParameterUtil.java:303)<br />
at org.eclipse.birt.data.engine.impl.ParameterUtil.resolveParameterBinding(ParameterUtil.java:215)<br />
at org.eclipse.birt.data.engine.impl.ParameterUtil.resolveParameterBindings(ParameterUtil.java:177)<br />
at org.eclipse.birt.data.engine.impl.ParameterUtil.resolveDataSetParameters(ParameterUtil.java:154)<br />
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.configureDataSetCache(PreparedDataSourceQuery.java:237)<br />
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:171)<br />
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:145)<br />
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:624)<br />
at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.extractQuery(DatasetPreviewTask.java:166)<br />
at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.doRun(DatasetPreviewTask.java:126)<br />
... 5 more[/size]Nothing works. Any help or pointers will be appreciated!<br />
<br />
Thank you
Find more posts tagged with
Comments
kclark
<a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/73-birt-cascading-parameters/'>Here's
a good devshare</a> that will show you how to do this.<br />
<br />
Basically how it works is your SQL statement will look something like this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
SELECT *
FROM CLASSICMODELS.EMPLOYEES
WHERE CLASSICMODELS.EMPLOYEES.LASTNAME = ?
</pre>
<br />
You'll need to edit the parameter in edit data set to point to the parameter you've created.