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)
Column names as parameters in the query
ajunuthula
Hi,
Can I give the column names as run-time parameters in the sql query, for eg.,
select ?,? from table-name;
where ? and ? are two parameters.
Thank you,
Aparna J
Find more posts tagged with
Comments
mwilliams
Yes, you should be able to do that. You will probably have to create your table dynamically then as your bindings will change as the parameters change.
ajunuthula
Thank you for the quick response!
Do you have any example that shows the table creation dynamically?
Thank you so much!
mwilliams
This one shows creating a dynamic table:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/317-birt---build-dynamic-table-(deapi)/
This one shows adding columns/bindings to an existing table:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1099-add-column-to-table-dynamically/
ajunuthula
Thank you!
mwilliams
Not a problem. Let me know if you get stuck. I'll try to help!
ajunuthula
Hi,
The second link below to "add columns to table dynamically" does not demonstrate how it is performed.
Do I need to add/install something to view the example.
Also, I can create the table dynamically using the first link below but I would like to issue the query as
"select ?,? from table"
Am stuck as how to proceed. Any idea?
Thank you.
mwilliams
How about this way instead:
You can create a report paramter with a list of the columns you want the user to select from, you can bring all of the columns into your dataSet and make a table with them, then you can use visibility statements to hide the columns that are not selected by the user? If your report is not too complex, the obvious performance drawback to this approach won't be so bad. Let me know.
ajunuthula
Yes, I can definitely do that.But I have a small problem here.
Assume my table has 5 columns... col1,col2,col3,col4,col5.
When a user wishes to see only col1,col3,col5, then using the visibily property I can hide col2 and col4 but how about the spacing in the report between col1 and col3, we can see empty space there.
If there is a way to avoid this, then it solves my problem.
Any idea?
Thank you.
mwilliams
Are you hiding the column or just the data element?
ajunuthula
Hiding the column, so if I hide the column2 then my report should be displayed as
column1 column3......
Any one viewing the report should not see the empty space between column1 and column3. Is this possible?
Thank you.
mwilliams
That's how it should work. What is your BIRT version? Can you attach your report design?
ajunuthula
version 2.6.1
Attached is sample report design.
I tried it but I can see the spacing between, space is not hidden.
Thank you.
mwilliams
You have the visibility statements on the actual elements, if you select the entire table, then select the tab above the column, there is a visibility statement for the entire column. Try that one instead. Let me know.
ajunuthula
Thank you so much, did not know about the visibility for entire column.
Its working.
Thank you again.
mwilliams
Not a problem! Glad to help!