Export prints headers but no data

Talk about Printing & Exporting Settings

Moderators: ne_moj, zewa

AndyL
Junior
Junior
Posts: 14
Joined: May 18th, '10, 12:41

Export prints headers but no data

Postby AndyL » May 28th, '12, 14:39

I have version 6.7.5.
There are two grids on the page, each with a unique prefix.
I am trying to export a grid to Excel. I have set the exporting directory, and the file is created in the expected directory.
It is then downloaded, and Excel opens it as expected. However only the headers are in the file - no data.

Looking at datagrid.class.php, I can see two functions: ExportTo() and ExportToCSV($page_size).
If I put a few echo's and print_r's in the file, I can see that in the ExportTo() function, if I add print_r($this->dataSet->fetchRow()); there is the grid data.

However if I do the same in the ExportToCSV function, first of all $page_size is zero, and there is no data at all. However the header data seems to be there.

I see that ExportToCSV is not called until I click on the little Excel icon.
It seems that the data is being lost between the generation of the grid, and the call to ExportToCSV.

How can I fix this?

administrator
Site Admin
Site Admin
Posts: 5939
Joined: Jan 7th, '09, 23:18
Contact:

Re: Export prints headers but no data

Postby administrator » May 29th, '12, 07:36

Download the latest version 7.4.9

AndyL
Junior
Junior
Posts: 14
Joined: May 18th, '10, 12:41

Re: Export prints headers but no data

Postby AndyL » May 29th, '12, 07:58

Could you provide a link?

administrator
Site Admin
Site Admin
Posts: 5939
Joined: Jan 7th, '09, 23:18
Contact:

Re: Export prints headers but no data

Postby administrator » May 30th, '12, 06:20

you must be registered as our customer and purchase it:
http://www.apphp.com/customer/index.php?page=login

AndyL
Junior
Junior
Posts: 14
Joined: May 18th, '10, 12:41

Re: Export prints headers but no data

Postby AndyL » May 30th, '12, 14:57

So there is no fix other than to buy the latest version?

AndyL
Junior
Junior
Posts: 14
Joined: May 18th, '10, 12:41

Re: Export prints headers but no data

Postby AndyL » May 30th, '12, 15:38

Well that was fun! I just bought the latest version and guess what - I have exactly the same problem.
The only thing that is exported are the column headers. There is no data.
What do I do next?

administrator
Site Admin
Site Admin
Posts: 5939
Joined: Jan 7th, '09, 23:18
Contact:

Re: Export prints headers but no data

Postby administrator » May 31st, '12, 07:34

Please send us a link to your online page with debug mode turned on, so we could check this issue and fix it..
You may contact us with PM.

AndyL
Junior
Junior
Posts: 14
Joined: May 18th, '10, 12:41

Re: Export prints headers but no data

Postby AndyL » Jun 19th, '12, 11:07

Apologies for the delay in replying, but I have been tied up with other projects. Unfortunately, this is not an online page accessible via the internet. It is used internally.
Is there anything else I can do to assist you to track this problem down?

administrator
Site Admin
Site Admin
Posts: 5939
Joined: Jan 7th, '09, 23:18
Contact:

Re: Export prints headers but no data

Postby administrator » Jun 20th, '12, 06:25

1. Update the current version to the latest.
2. Check all your fields DON"T have 'show_on_export'=>'false'
3. Debug exporting method in DataGrid class (if you're familiar with PHP)
4. Send us screenshots, so we could see what happens.

AndyL
Junior
Junior
Posts: 14
Joined: May 18th, '10, 12:41

Re: Export prints headers but no data

Postby AndyL » Jun 21st, '12, 12:08

The grid is the latest version. There are no fields with show_on_export set false.
I'm no expert, but I have been doing a bit of debugging.
As far as I can see, when you click on one of the "export" icons, the file that created the original grid is run again.
For example, in my case, the file is called like this:

http://xxx/xxx/report.php?ts=2011-10-26 00:00:00&te=2012-10-26 00:00:00

You can see it has two parameters that are passed into the sql command to locate data between two dates.
These are, in the php script, $_GET['ts'] and $_GET['te'].

When you hit "export" and the script runs again, $_GET['ts'] and $_GET['te'] are both null.
Therefore the SQL command finds the headers OK, but not the data. So the exported file only has headers.
session_start() is on at the beginning of the script.
As I don't know whether the script is being called from the export function or not, I'm not sure what to do here.
I could store $_GET['ts'] and $_GET['te'] if they are not null in a session variable, and subsequently use the session variable as the input into my query, but this seems to be a bit of a kluge.
Any ideas?


Return to “Settings: Printing & Exporting”