Is it possible to pass a query as parameter in BIRT report? - sql

I want to ask the user to input a query then the BIRT will generate a report based on user's query.
So far, what I do is pass the parameter to this.queryText but I can't think of a way on how will BIRT display the results.
Is this possible?

You can achieve this by following below steps :-
Create report parameters if required, which can be passed by user.
In SQL dataset beforeOpen() event build and assign dynamic query:-
example- this.queryText = "Select * from " + params["parmtable"].value;
If you have any other requirement, could you please elaborate it. I will surely try to help you with a sample rptdesign file.

This is not directly possible.
However, with a little help from outside (e.g. getting the description of the cursor from the DB, it is possible to generate (and save, if you like) and finally run an rptdesign file by calling the DE API from Javascript. I've done this, but it is very cumbersome. Furthermore, what if the user wants to supply parameters?
From a security point of view, the whole approach is not recommended.
IMHO BIRT is not the right tool for this, because this task requires more low level programming. If you are free to choose, I'd recommend Python with the ReportLab toolkit (a library to generate PDF) together with cx_Oracle (depending on your DB) or Java with iText and JDBC.

I don't have any other option aside from this.
First. (I use java btw) My program accepts and execute the query. Then using the ResultSetMetaData, I get the column names. (to be use as reference to my data source)
Then. I passed the full query and the list of columns to the method buildReport() (Please refer to How to Build Dynamic Table (BIRT) sample code)

Related

query XML file in a sql script

In HANA, I need information on calculation view like cross client or not, commentary on node, cardinality...
Those information are in XML file of the calculation view. Is it possible to extract it with a procedure?
During my research I found this : https://archive.sap.com/discussions/thread/3600091
I hoped that now it would be possible.
If you have any idea, please share with me,
Thanks in advance
I'm replying to the question on getting the metadata or attributes from a view. You can probably find these in tables like _sys_bi.bimc_* (e.g. BIMC_PROPERTIES in the _SYS_BI schema), SYS.VIEWS, SYS.VIEW_COLUMNS, SYS.cs_view_parameters (has the client as a parameter) or sys.view_columns.
I think it's easier to extract this information from the automatic documentation file in PDF format from HANA Studio, though, but it depends on what you are trying to do.

Advantage to using SSRS or Crystal reports when the output is simple and static?

I have an ASP.NET/C# web app in which the user needs to run reports with various criteria that will ALWAYS yield simple, 2-dimensional, tabular data. I'm tempted to use a sophisticated reporting engine like SSRS or Crystal Reports, but these seem like overkill, since there's really nothing to design (all outputs will be to CSV, or JSON for the browser to render in an HTML table).
In this scenario, am I eating too much complexity by trying to use SSRS or Crystal Reports? Should I instead just write custom classes to dynamically assemble SQL statements (based on user selections) that will be fired against the database?
Does SSRS or CR add anything that is of value (within the requirements constraints I've already described)...?
Its depend on your requirement if you want to minimal overhead on your web app then please go ahead and use your custom codes since you are not required any styling or extra functions.
Just get JSON objects and fill in HTML and go Head !!
I am working with ssrs So i will talk just about it:
ssrs is a very useful tool for building a Reports
all You need is sql server Stored Procedure to build your report
then deploy it to report server and use this report from your app
-now all you need in your app just one page for all reports and you path the URL
dynamically with report name
You need to know this :
-ssrs did not work correctly with all browser
for Exp :
-Print Btn just work with IE
so Mozila and Google you need to use java script to print Report
-some issue with criteria section :
there is no way to rename the 'select value' with drop down
so you need to use java scrip to handle it
also you find ( Null and chick box ) any customer did not know what null mean so
you need first to remove null keyword or to rename it to anther Keyword
also you need java script to do this
the most problem i have :
all reports in reports server so
when i go to a new client what i need
just Sql server no need to setup visual studio and ssrs tool
just to deploy all reports on client report server
its very bad ..
i solved this issue with tool i had make to deploy the all the report
and no need to setup VS just to deploy the report
i think that the most important problem i have
and all of it i found a work around to solve .. and it takes more time
finally :
use ssrs or CR its very easy to use and make report very fast no need to create a custom page for report and develop all its control just like print and export
report to PDF,excel or any type
but if you have a few report i think no need to use any reports tool

How to create pdf Template with the dynamic values

I am stuck in this task from a month ago so my last option is to post my query on stack-overflow.
I have to find a PDF Creation tool where i can crate my PDF Template and also i can assign a data source like sql server or any thing else. by which the sql server dynamic data can replace the value of pdf template Tags.'
I have tried many tools like Foxit and bulzip . But any of the tool does not meets my requirement. I must say I have completely stuck in this Task.
So Please give me appropriate solution . Immediate response will be appreciated.
If you want to create pdf in client side, you can try jspdf
If you are using php for server side, you can try mpdf.
Have a look at wkhtmltopdf. It's a very simple console utility that creates PDF from HTML. So basically you need to generate HTML markup. You can use some scripting language (PHP, python, etc.) or templating engine, depending on what exactly you want and what tools you are familiar with.
Create HTML/CSS markup for your template.
Define places where you want to put dynamic data, mark it
somehow.
Create script that will query database for your data and then
Either use search&replace in your script to place real data, or
copy whole HTML as a template using some templating engine (for
instance, PHP is itself a template engine, so you can basically
place save template as PHP file where real data is placed where
needed).

Django convert Model to sql code

My plan is to be able to dynamically generate SQL tables. Since I know django can create SQL tables using models, they must have a function for this. The problem is I can not find this function in the Django folder, or maybe I simply don't recognize it.
thnx
It's called django-admin.py
Start here: http://docs.djangoproject.com/en/dev/ref/django-admin/
Specifically, see http://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-sql
I am not exactly sure what you mean, but you can get the SQL for all the tables in an app by running this command:
python manage.py sqlall your_app
If you're looking for the specific pieces of code, have a look at django.db.backends.base.creation to see how the sql is generated, of course there need to be individual implementations for different database types, so for example also see django.db.backends.postgresql_psycopg2.creation!

How to present the result of a dynamic pivot request in SQL Server 2005 Reporting Services?

I have a dynamic pivot request I would like to present in a report of Reporting Services.
As it is dynamic, the number of columns of the result is variable (as is the name of the columns). How could I create a report showing a table handling this variable number of columns ?
You can also use the Matrix control to pivot the results in the report instead of in the query. This way you don't have to use any custom solution.
You will need to implement a dynamic report definition file. Here is a link that will help you get started. It is a VS Project that dynamically creates a RDLC file with a table, via a datatable. I used it as the base of my current report system.
C# Version
VB.NET Version
If you have any questions about this, let me know. I've been generating RDLC files for quite a while now, and encountered pretty much every issue you could think of :)