Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » PHP dumps JSON file for BIRT to read from
PHP dumps JSON file for BIRT to read from [message #912305] Thu, 13 September 2012 09:53 Go to next message
karvesh ghunsam is currently offline karvesh ghunsam
Messages: 95
Registered: July 2011
Member
Dear Jason,

Is there a way for BIRT to access a flat CSV or JSON file created by php so that it can create a dynamic report?

I am thinking to supply a relative url in the scripted datasource on fetch event in the report that can open the file and dynamically create the columns and populate the data.

I saw such an example in the project zero page by Ant Phillips..

Could you please help me here with any example..

Thanks in advance

Karvesh
Re: PHP dumps JSON file for BIRT to read from [message #912522 is a reply to message #912305] Thu, 13 September 2012 17:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Karvesh,

Are you wanting the entire report created on the fly?


Jason
Re: PHP dumps JSON file for BIRT to read from [message #912701 is a reply to message #912522] Fri, 14 September 2012 02:52 Go to previous messageGo to next message
karvesh ghunsam is currently offline karvesh ghunsam
Messages: 95
Registered: July 2011
Member
Dear Jason,
it is basically a horizontal cross tab report with numerous columns and data that are filled in from precalculations.

I thought it would be cleaner to use php to dump a JSON file with the dynamic columns and data into a folder for the specific user session.

Then php will call birt and pass the location of the file as a parameter and maybe the column names (comma separated) as another parameter.

Birt will then load the JSON file and create all the columns on the fly and even populate the rows of the newly created columns. In fact, i think that a scripted dataset will need to be created from the JSON file..

Is there a way to do that?
I saw in Birt 4.2 that there are excel datasets. But it seems to need some pre configurations so that it can distinguish the columns..

Could you please help me here?

Thanks a lot
Karvesh
Re: PHP dumps JSON file for BIRT to read from [message #913059 is a reply to message #912701] Fri, 14 September 2012 17:25 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Are you wanting to use the BIRT viewer or do you want to write your own servlet.
This is an older example:
http://wiki.eclipse.org/Java_-_Build_Dynamic_Table_%28BIRT%29
That builds and runs the report on the fly. If you are using BIRT 4.2 do not set a birt home. Another option is to use DE API in a beforeFactory script to add content. There
are a lot of examples on Birt Exchange
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1382-dynamic-columns-based-on-parameters/


Jason
Re: PHP dumps JSON file for BIRT to read from [message #913228 is a reply to message #913059] Sat, 15 September 2012 02:51 Go to previous messageGo to next message
karvesh ghunsam is currently offline karvesh ghunsam
Messages: 95
Registered: July 2011
Member
Dear Jason

Thanks for the hint..
But I also want to be able to create the table from data coming from a JSON file..
Any clue how to do that?
Re: PHP dumps JSON file for BIRT to read from [message #915632 is a reply to message #913228] Mon, 17 September 2012 17:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

What does the JSON data look like? Does it change frequently?

Jason
Re: PHP dumps JSON file for BIRT to read from [message #915821 is a reply to message #915632] Tue, 18 September 2012 02:48 Go to previous messageGo to next message
karvesh ghunsam is currently offline karvesh ghunsam
Messages: 95
Registered: July 2011
Member
Dear Jason

The JSON File will change almost for every query, even the number of columns
It will be pretty much dynamic..

I will have to pass the column names as parameters into BIRT so that they match the number of columns created by the JSON file. The JSON file will be created in the session folder of the user. So each user will have their own session JSON file..

Thanks
Karvesh
Re: PHP dumps JSON file for BIRT to read from [message #916112 is a reply to message #915821] Tue, 18 September 2012 14:53 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

In the beforeFactory you can access the JSON object using Java and then define a scripted data set and table to display them using the DE API. If you can post an example JSON file and tell me which Java api you use to parse JSON objects I can help build you an example.

Jason
Previous Topic:Best performance question
Next Topic:Crosstab issue - not to sort alphabetically
Goto Forum:
  


Current Time: Tue Sep 16 03:03:44 GMT 2014

Powered by FUDForum. Page generated in 0.01973 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software