Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Dynamically change column in query?
davidch
I am looking for a way to pass a column name to a report query as a parameter coming from another report.
For example, I want to make the query like:
select * from myTable
where ? = ?
The first ? would be the column name of myTable and the second ? would be the string value that I am looking for.
This way I can display details for rows only where a certain condition is met. The problem I am running into is that I do not see a way to do this. I have not found a way to pass a sql string to the query. Is it possible to do this?
Find more posts tagged with
Comments
mwilliams
davidch,
In your dataSet's beforeOpen script, you can use 'this.queryText = "Query String";' to pass whatever query you'd like.
davidch
thanks!
that worked perfectly
prabha
Where is this dataset's before open script.I could not get this
Could you please detail about this?
Thanks,
Prabha
lalit0507
Hi,
I need to pass column name and its value at runtime to query. I am using JDBC datasource for connection. I tried to override beforeopen(), but not successfully done.
Please any 1 can suggest me how can i do it.
Lalit
mwilliams
Hi Prabha,
If you click on the dataSet in the "Data Explorer", then click on the "Script" tab below the design window, you should be able to get to the beforeOpen method of the script.
mwilliams
Hi Lalit,
What version of BIRT are you using? Also, what code did you use in the beforeOpen method? Can you post it in here? Thanks