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)
Dynamically generating the TABLE
nitinrk31
Hi all,
I want to generate the report dynamically using Php JavaBridge..
I want to create the table dynamically, means columns and rows dynamically based on the selected columns from the database table using PHP code
Does anybody knows how to do it
Please if anybody knows than please let me know...
Find more posts tagged with
Comments
mwilliams
Will you have a parameter that lets you know the columns that were selected? If so, you could just build your report table dynamically in your beforeFactory script of your report.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1099-add-column-to-table-dynamically/
nitinrk31
Hi williams,
Am new to the birt reporting tool i dont exactly how to determine the number of columns selected in a query but i can have the idea of how many number of columns will be sent to the report from the Php..
Am sending the query from php itself..
Do you know how to do this...
If you have any document on how to use birt with php than please send me
Thanks in advancde
mwilliams
Check out this devShare post:
http://www.birt-exchange.org/org/devshare/deploying-birt-reports/743-calling-birt-from-php/
As for my question about you building the table dynamically, is your query going to be the same each time? Same columns? Or will a user select which columns that they want to see so that you can pass this information in? Or how is the query built/how are the columns determined?
nitinrk31
Hi william,
Thanks for your response the query will never be same, it will be changing based on the user selected columns..
user will select the columns, so i have to generate the table and its columns dynamically according to the columns selected..
Can you help regarding this how to do achieve it?
mwilliams
That's what I was looking for!
If the user selects the columns, then you'll have parameters to tell you what will be in the report, therefore you can build your report table like in the example posted above, using the user selected parameters to tell you how many columns to make and what the binding will be.
nitinrk31
Thanks williams,
I need one more help...
I have some 100 employees and i want to generate the report for each employee in single page...
The result set generated from the query will be containing all the 100 rows but i want to show one employee per page and creating links like NEXT,PREVIOUS to iterate through all the employees to the reports employee wise
It it possible? if it is possible than please explain me how to do it..
Thanks in advance...
mwilliams
A good way for this might be to create your report as if you're creating it for one employee. Use a parameter in your dataSet to limit the data to a single employee. Then, have a dataSet that brings in all your employee ID's and put them in an array that you can step through forwards or backwards by clicking on either the "previous" or "next" label that you've put in your report that hyperlink to either the previous or last employee in your array. You would just pass the value through the drill down to the same report. This would reload the report for each employee rather than running them all at once, but it sounds like it would meet your requirement.
Hope this helps.
rajag
Thanks for the information. I am new for BIRT.
Is there any way to control (Hide/Show) the column based on the data. Example header information retrieved from the database using the separate query. If possible then will it be possible in Cross Tab?
mwilliams
If you're using the BIRT viewer and want all of the reports to be in the same report, you could just use the pagination in the viewer. It has "previous" and "next" arrows already. Forgot to mention that above.
mwilliams
I'm not sure how your crosstab is set up. If you could reproduce this with the sample database, it'd help in my understanding.
nitinrk31
Hi willams,
I have another problem, i have 4 data sets and in each data set i have unique column called empid and i want to break the report to display the one record per page in BIRT VIEWER so it look like per employee report...
Report page has 4 tables and these 4 data sets binded to the tables
so can you explain me how to do it...?
nitinrk31
Hi williams,
Am waiting for your reply,please reply how to do it... if you want i can send you the .rptdesign file to go through it...
mwilliams
Sorry for the delay, I was at EclipseCon last week. So, you have 4 tables that you want to show for each employee? Is this correct? If so, you would create an outer table that only had the unique employee IDs field, you'd then embed your 4 tables into this table and use the dataSet binding parameter option to bind your dataSet parameters to the outer table value if using JDBC dataSource. Otherwise, you'd filter your inner tables by the same. Hope this helps. Let me know if I've understood incorrectly.
nitinrk31
Hi williams,
Yes williams whatever you understood is correct
Am not getting about this point "dataSet binding parameter option to bind your dataSet parameters" can you explain me in detail..
If possible can you send one such a example for at least 2 tables...
if you have time than please send me the .rptdesign file..
Thanks in advance
nitinrk31
Hi williams,
I got it working by applying filter on inner table...
Thanks for your valuable reply...
I have another question..
At the time of creating the report using eclipse am using a datasource and i want it to be changed at the time of running the report in birt viewer.. means i have one datasource at the time of designing a report but later at the of running the report i want to change the datasource only..
The dataset will be same as the time of creation, i just want to change the datasouce only...
How to do it?
please help me..........
mwilliams
Can you not just change the connection information in the dataSource prior to deploying?
nitinrk31
Hi williams,
Am not getting how to change the connection information at the time of deploying..
Can you explain me how to do it?
Can you send me one such a example how to change the datasource at the run time..
mwilliams
I thought you were just changing the dataSource when you deploy the report? If you're doing this, you should simple be able to change your static connection information before deploying your report. If you want the info to be dynamic, you can use the property binding tab in the JDBC datasource to create expressions to dynamically change your connection information. Am I misunderstanding something?
You could probably also have your different sources set up within BIRT and dynamically change which source you use for your dataSet.
Let me know.
nitinrk31
Hi williams,
I will clear you the requirement, i have created the .rtpdesign file using some datasource which will not be used for all the time means its like a dummy datasource and datasets for just previewing whether the output is generated correctly or not...
Now whenever request comes for this report i want to change the datasource and datasets to real ones and run the report
Is it possible to change the datasource and datasets of report dynamically at the time of running the report?
if so than how it can be achieved...
mwilliams
Are the dataSource and dataSet going to be the same type? For example, your dataSource is a JDBC in your sample and so is the one you want to use for the deployed version? If you keep the dataSet the same and the columns are the same, the dataSet doesn't need to change for a JDBC one, you'd just need to change the database URL for the database you want to connect to.
nitinrk31
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="75345" data-time="1301606054" data-date="31 March 2011 - 02:14 PM"><p>
Are the dataSource and dataSet going to be the same type? For example, your dataSource is a JDBC in your sample and so is the one you want to use for the deployed version? If you keep the dataSet the same and the columns are the same, the dataSet doesn't need to change for a JDBC one, you'd just need to change the database URL for the database you want to connect to.<br /></p></blockquote>
<br />
Hi williams,<br />
<br />
Exactly, whatever you understood is correct...<br />
My dataSorce will always be JDBC only and it will be having same tables as the dummy one...<br />
<br />
As far as dataSet in concerned, the columns will always be same but the condition in the where clause is going to change all the time..<br />
<br />
So is it possible to change the dataSource and dataSet of a report design file just before the running the report?<br />
<br />
Is there any way that to open the existing .rptdocument to modify the dataSource and dataSet and than save the design and run it?
mwilliams
You could do something as easy as passing a hidden parameter and changing the connection information based on this parameter in the property binding tab of the dataSource editor. If your hidden parameter value is 0, you use the testing database if it's 1, you use the actual database.
nitinrk31
Williams,
Am using birt viewer to dispaly the reports, so how the hidden parameter will be sent to the report?
mwilliams
You would pass it through the URL. By making it hidden, it won't show up on the parameter page as to not confuse your user.
nitinrk31
Hi williams,
Am using PHP to call birt viewer to run the report...
My birt viewer is installed in the default location ex: C:/Program files/Apache Software Foundations/Apache Tomcat 5.3 /WebApps
And my report designs are in different folder for Ex in D drive
So how can i call the birt viewer to run my report and hwo to send the parameters hiddenly to the report design..
Somehow i manage to call the birt viewer to run my report design file but am failing to supply the parameters to the report design...
Can you give one such a example how to send the parameters to report design through url by calling birt viewer????
mwilliams
Have you created a parameter in your report design and checked the "hidden" checkbox in the parameter editor? If so, you have a report parameter available to pass your value in your URL. After calling the report in the URL, you'd just start with the paramters &__paramName=value. Let me know.
nitinrk31
Hi williams,
I followed your steps and its working fine....
I have another question, Is there any way to make report parameters invisible in the url..
Means parameters and its value should not be displayed in the url but it should be passed to the report..
Am using php to redirect to birt viewer..
mwilliams
If you use java code to call the reports, I know that you can send parameters from your application through the BIRT context rather than sending them through the URL. You could always send an "encoded" value through the URL and have "decode" script in your report script to change it to the actual usable value so that an end user wouldn't know what the value meant.
nitinrk31
Hi williams,
I was also thinking in the same way as you mentioned..
Do you know any encryption and decryption methods to achieve this?
mwilliams
Depending on the security level you need, you could probably find encryption/decryption scripts on the web for higher levels of security, but if you just need simple masking, you could create a word or letter replacement key in your own script to encrypt and decrypt the value you pass.
Hope this helps.