Results 1 to 6 of 6

Thread: Exporting data, containing line-breaks

  1. #1
    krafft is offline Sugar Community Member
    Join Date
    Jun 2006
    Posts
    16

    Default Exporting data, containing line-breaks

    Hi,

    when exporting contacts into csv, field entries with a line-break (eg. in Address or Description) are divided into two lines (two datasets), which make the export useless.
    How can I tell the system to ignore those line breaks?

    I read another threat about field separators, however my Admin section does not allow me to select anything like this (see http://www.sugarcrm.com/forums/showt...export+contact)

    thanks for any help,
    cheers

  2. #2
    goodwasabi is offline Member
    Join Date
    May 2007
    Posts
    5

    Default Re: Exporting data, containing line-breaks

    I have exactly the same problem, have you found a soltion for it?

    Thankyou,

    Marco

  3. #3
    krafft is offline Sugar Community Member
    Join Date
    Jun 2006
    Posts
    16

    Default Re: Exporting data, containing line-breaks

    Quote Originally Posted by goodwasabi
    I have exactly the same problem, have you found a soltion for it?

    Thankyou,

    Marco
    Unfortunately not.
    So far we had to do it manually.

  4. #4
    goodwasabi is offline Member
    Join Date
    May 2007
    Posts
    5

    Default Re: Exporting data, containing line-breaks

    I guess the easyest thing is to make a small program/macro that searches for all line breaks and carriage returns within the field delimitors " or | and changes them with something like --

    I'll let you know if I find something better,

    Marco

  5. #5
    Snook is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    52

    Lightbulb Re: Exporting data, containing line-breaks

    Yop,

    I just found a way to solve this issue:

    In the file: include/export_utils.php
    Search for:
    PHP Code:
     foreach (array_values($val) as $key => $value) { 
    Before:
    PHP Code:
    array_push($new_arrpreg_replace("/\"/","\"\""$value)); 
    Add:
    PHP Code:
    $value str_replace("\r\n"," -- ","$value"); 
    So in this case I add " -- " instead of the linebreaks, which can be " <br />" or simply an empty string "".

    Hope this is a clean way to resolve the problem.

    --
    Damien Snoeck
    Optaros

  6. #6
    ReeKeePee is offline Junior Member
    Join Date
    Oct 2009
    Posts
    1

    Default Re: Exporting data, containing line-breaks

    Thank you! Works perfectly.

    One question comes to mind: our consultant, who installed Sugar on our server, told me about the /custom folder to which I copy the export_utils.php file in so the modification is upgrade proof (actually the file is copied in /custom/include). Was he right? At first, we copied the file (export_utils.php) in the "/custom/include" folder and modified this copy. It didn't work. What went wrong? Was I misled?

    Thanks!
    Last edited by ReeKeePee; 2010-04-20 at 08:47 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP Warnings after install add-in Module
    By kgeving in forum Help
    Replies: 1
    Last Post: 2006-08-08, 05:54 PM
  2. Replies: 0
    Last Post: 2006-07-03, 09:54 AM
  3. ERROR in 4.01
    By rateck in forum Help
    Replies: 3
    Last Post: 2006-02-02, 10:00 PM
  4. Multiple errors
    By amoslmeditabcom693427 in forum Help
    Replies: 0
    Last Post: 2004-11-11, 05:02 PM
  5. Errors when importing
    By amoslmeditabcom693427 in forum Help
    Replies: 0
    Last Post: 2004-11-09, 05:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •