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)
Parameter in SQL statement
Ulf
Hey guys,
here is my problem:
I want to sort my SQL statement by an parameter.
It's a textbox where you can choose how the sql statements should be sorted (name,age etc.)
My SQL statement is:
select * from test ORDER by ?
I created a new parameter in "Report Parameters" and created a Parameter in "Edit Data Set -> Parameters".
This Paramter is linked to the Report Parameter.
But if i want to run the Report i don't get any Results.
And in "Preview Results" i only get "Failed to prepare the following query for the data set type...."
Reson: "A Birt exception occured".
Can some help me ?
Thanks
Find more posts tagged with
Comments
mwilliams
Hi Ulf,
One thing you could do would be to just use a simple query and add your ORDER BY statement in the beforeOpen script of your dataSet.
Query:
select * from test
Then, in the beforeOpen script, you'd put something like:
this.queryText = this.queryText + " Order by " + params["parameterName"];
Let me know if this works for you.
Ulf
Hi,
thank you for your support
!
There was only one thing :
this.queryText = this.queryText + " Order by " + params["parameterName"];
is wrong ... it must be
this.queryText = this.queryText + " Order by " + params["parameterName"].value;
mwilliams
Sorry, forgot that part. My mistake!
Anyways, glad to help. Let us know whenever you have questions.