Append new line in csv-export
Archived from the Xataface Users forum.
danny — Mon Jul 02, 2007 8:39 am
Hi Steve,
i«v got a text-field that may contain some carriage return (CR). When I import the file to Excel oder Access the import routine cuts the record at the point of the CR. So I«ve got a new line that contains just the rest of the text-field.
One example:
“1670”;”20070629120420”;”Max Muster”;”This is example text.
This is the rest after I hit enter”
How can I avoid this? I found the place to change the value for the “Append new line” string in export_csv.php. But I rather need to change the string for the CR of the field(s).
Any idea?
Best regards
Daniel
danny — Tue Jul 03, 2007 2:16 am
I«m very proud to tell you that I solved the problem on my own )
Just added the following lines in the export_csv.php file (after $dataArray = array_map(‘addslashes’, $dataArray):
$dataArray = str_replace(“\r”,” –”,$dataArray);
$dataArray = str_replace(“\n”,”– “,$dataArray);
This replaces the CR and the line feed (LF) in the fields against some “ —- “. Now I«m able to open the exported files without those naggy lines
jitu — Sat Sep 29, 2007 5:30 am
hi
i want to make a csv file of record listed when i click
so wat to do to make csv file of one table record
so lz help
Thanks even u cant help me
shannah — Sat Sep 29, 2007 8:38 am
I’m not sure I completely understand the question. Is it that you just want to export a single record to CSV?
If this is your question then…
The export_csv action always exports the current found set in CSV format. If you perform a find that finds a single record, then export_csv will export that single record. You can also use Dataface URL conventions to link directly to the CSV export set that you want. For example,
http://yourdomain.com/yourapp/index.php?-action=export_csv&-table=people&person_id=10
Will export only the record from the people table with person_id=10.
Hope this helps.
-Steve
jitu — Sun Sep 30, 2007 11:09 pm
hi
i have see ur reply but my problem still not solve
my database name = device
no of tables =3
i want to make csv of records of one table let the name is device_details when i click on show all of details menu. i have 16 months experience on LAMP but i m new in dataface so it become quite tough
whatever u given me solution i applied but the folloeing errors come
Fatal error: No template found for action ‘export_csv’.On line 48 of file /var/www/html/dataface10/actions/default.php in function printstacktrace()
On line 801 of file /var/www/html/dataface10/Dataface/Application.php in function handle(array(array(export_csv,export_csv)))
On line 1152 of file /var/www/html/dataface10/Dataface/Application.php in function handlerequest()
On line 5 of file /var/www/html/device/index.php in function display()
in /var/www/html/dataface10/actions/default.php on line 48
and its for one record only and i want all record of table should printed
Thanking u in advance
Jitu Thakur
jitendra_forum2006@yahoo.co.in
shannah — Mon Oct 01, 2007 9:55 am
What version of Dataface are you using?
The error that you are receiving indicates that your dataface install doesn’t include the export_csv action.. but this has been in there for quite a while.
-Steve
jitu — Tue Oct 02, 2007 10:27 pm
hi steve,
I got ur reply i m using dataface 0.7.1 and also dataface 0.6.10. in both case i changed in index.php
and following are the my index.php content
display();
?>
only i changed dataface to dataface10 i.e my dataface 0.6.10 but i dint get the solution
don’t have tutorials on this topic if it is online kindly send me the url
so i can do RND
Thanks steve i will send one bottole of whiskey if u solved my problem(Joking)
Thanks
Jitendra Dinanath Thakur
jitendra_forum2006@yahoo.co.in
shannah — Tue Oct 02, 2007 11:26 pm
Your index.php file code didn’t come through… that isn’t the most important thing though.
Check the actions directory in your dataface install that you are using. Confirm that it has a file named export_csv.php . If not.. download a newer version.