Page 1 of 1

Export_csv truncates content from mediumtext field

PostPosted: Sat Apr 25, 2009 10:15 pm
by s_nalepa
Hi Steve!

I have got a mediumtext field to store item descriptions including html from an htmlarea. There are no problems with storing and viewing quite long descriptions, but after exporting to csv long posts get truncated approx. just before the 256:th character! Where should I look for a restriction?

PostPosted: Mon Apr 27, 2009 12:36 am
by s_nalepa
I noticed, that the cutting also occurs in the list view - exactly at same place. But in the detailes view you can see the entire text just as it is stored in the database. So it should be possible to also export the entire text and not just the truncated part from the list view. Please help, it causes huge problems for my collegues while trying to mount the text for a printed catalogue!

PostPosted: Mon Apr 27, 2009 6:48 pm
by shannah
What version of Xataface are you using? I seem to recall fixing this issue a while back, but I might be imagining things.

PostPosted: Mon Apr 27, 2009 8:28 pm
by s_nalepa
I use the 1.1.4 971 version.

PostPosted: Mon Apr 27, 2009 9:12 pm
by s_nalepa
On line 1661 in Dataface/Record.php there is a limit for the preview version of a field: $maxlength=255 . This corresponds to the length of the truncated fields. I will try changing this value later today at work. But I don't believe it is the proper way to fix the export - I wonder why/where there is a call to this preview in the export script (if this is the problem).

PostPosted: Tue Apr 28, 2009 11:47 am
by shannah
I just checked the logs in SVN and it appears that this was fixed about a year ago and there have been several versions since (I think your version should be current enough).

Is this happening when you export from list view? Or is it only for related record tabs? (i.e. is it in the "list" tab, or a sub-tab of the "details" tab?)

PostPosted: Tue Apr 28, 2009 9:32 pm
by s_nalepa
It happens when I export from a list view. The affected field is in the main table. The list view is filtered on a field in the main table through the url.

I have made a temporary solution by tweaking the export to xml so I can get the contents from the source view of the web page with the xml result, I put tabs and newlines instead of xml tags. The export to xml does not truncate the posts with long content, but I have to replace all html-entities myself and remove blank lines.

Changing the $maxlength variable in Record.php did not make any difference.

There is obviously a difference in how the export to xml and the export to csv work, besides the fact that export to csv writes to a file. But I can't find the difference in how the database is queried, or anything else that affects the result.

PostPosted: Wed Apr 29, 2009 7:29 am
by shannah
You should try at least downloading the latest version of xataface and see if that clears it up. I can't reproduce this. I export to CSV - some cells contain many many pages of information.