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)
Lists as variables or parameters
BRM
I have a lot of reports that are based on queries that use the IN statement in sql. I.e.
SELECT *
FROM tbl
WHERE tbl.code IN ('code_1','code_2,'code_3,'code_4,'code_5,'code_6)
A lot of reports use the same list but have different return fields and condition. The codes that need to be selected change every so often and it is a fair bit of work to update the lists in all of the queries that use them.
Is there a way to store the lists of codes as a report parameter or a variable? If the latter how do I incorporate it into a query. Even better could I hold the list somehow external to the report and import it into the report that use it.
Thanks in advance.
Find more posts tagged with
Comments
mwilliams
If I'm understanding correctly, you could just store your code list in a text file and read that file in in your beforeOpen script of your dataSet and edit your query to include the read in codes. This would allow you to change the list in a central location without having to change every single report.
BRM
Thanks for your reply.
I'm a BIRT On Demand user so local files are a problem. What I have decided to do is this.
SELECT *
FROM tbl
WHERE tbl.code IN (SELECT codes FROM code_map WHERE summary_type = 'xxxx')
And I just have a little table in the db that contains the codes. I've read this can be a little slow but I think that for the table sizes I am talking about it will not be that noticeable.
Thanks again.
mwilliams
If it becomes a problem, just let me know, and we'll try to figure something out for you!