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)
Validating Input Parameter Against Database Value
easothomas
Hi
In my report, I need the user to enter a parameter, which happens to be a table name, which is in turn, present in a database table.
For example, assume I have to generate reports for different type of cars viz. BMW, AUDI, BENZ, PORSCHE.
I have a default metadata table called "CARS" which will have the entries
CARS_ID CAR_TABLE_NAME
1 BMW
2 AUDI
3 BENZ
4 PORSCHE
--
My Customers/users can add any number of entries here which is not in my control. I expect that a table with name mentioned in CAR_TABLE_NAME be present in the database with a schema I specified.
So in this case, I expect BMW, AUDI, BENZ and PORSCHE tables to be present in the database.
The user will be entering one of the names as the parameter and I need to validate whether the entered value is actually present in the CARS table. If it is present there, then I need to check whether if the table exists in the database and then carry on my operation. These I do it via db queries.
But how will I actually test it when I am running the report via the command prompt. If I don't validate first, then I will be running a query like
"select * from VOLKSWAGEN"
which will throw me a "SQL statement does not return a ResultSet object." Exception
---- Can I query the database directly without creating a dataset?
---- Can I create a dataset and then invoke it directly/without the help of a table
please help.
thanks
Find more posts tagged with
Comments
averma
Hi easothomas,
You can use scripting in your BIRT report to add a database table validation check, here is an example for validation of date parameter that you can learn from:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1297-date-validation/
You can also dynamically add a data set to a report using scripting, here is an example:
http://www.birt-exchange.org/org/devshare/interactive-reporting/1317-using-the-deapi-to-dynamically-add-a-data-set/
To invoke the dataset you will need to use it in your report, probably a table element and hide it if you dont want to show this.
Ashwini
easothomas
<blockquote class='ipsBlockquote' data-author="'averma'" data-cid="98346" data-time="1332957839" data-date="28 March 2012 - 11:03 AM"><p>
Hi easothomas,<br />
You can use scripting in your BIRT report to add a database table validation check, here is an example for validation of date parameter that you can learn from:<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1297-date-validation/'>http://www.birt-exchange.org/org/devshare/designing-birt-reports/1297-date-validation/</a><br
/>
<br />
You can also dynamically add a data set to a report using scripting, here is an example:<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/interactive-reporting/1317-using-the-deapi-to-dynamically-add-a-data-set/'>http://www.birt-exchange.org/org/devshare/interactive-reporting/1317-using-the-deapi-to-dynamically-add-a-data-set/</a><br
/>
<br />
To invoke the dataset you will need to use it in your report, probably a table element and hide it if you dont want to show this. <br />
<br />
Ashwini<br /></p></blockquote>
<br />
Thanks Ashwini for the links. That serves my purpose.<br />
<br />
Easo Thomas