3 of 3
3
Plugin: CSVee
Posted: 08 July 2008 01:16 PM   [ Ignore ]   [ # 37 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15380
Joined  05-15-2004

This is utf-8 data being displayed as iso-8859-1. You need a unicode-aware text editor.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 24 July 2008 12:43 PM   [ Ignore ]   [ # 38 ]  
Grad Student
Avatar
Rank
Total Posts:  70
Joined  07-06-2007

SOLVED: I renamed the file from .csv to .txt and then copied and pasted the contents into Excel. Worked great.

I’m trying to use CSVee to export FreeForm entries so clients can review survey data in Excel. I’m running into a problem with line breaks in the comment fields. Anyone know of an easy trick to import the CSV into Excel so the line breaks don’t case a jump to a new row in Excel?

 Signature 

Mark Terpstra
http://markterpstra.com

Profile
 
 
Posted: 16 October 2008 07:10 AM   [ Ignore ]   [ # 39 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12390
Joined  04-29-2002

Daniel, I’ve been starting to use this again, but one question remains.

How do I set a deliminator to nothing? In Excel, I can export as tab separated with no delimiters. That’s what I’m going for here. Figured out how to set the separator to tab. smile

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 18 October 2008 04:25 AM   [ Ignore ]   [ # 40 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

Sue, for now you can just make a quick change to the source code;

Find this:

switch(strtolower($custom_delimiter))
        
{
            
case 'tab'            : $delimiter = "\t"; break;
            case
'space'        : $delimiter = ' '; break;
            case
'double-quote' : $delimiter = '"'; break;
            case
'single-quote' : $delimiter = '\''; break;
            default                : $delimiter = $custom_delimiter; break;
        }

And add another case:

case 'nothing' : $delimiter = ""; break;

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 18 October 2008 05:06 AM   [ Ignore ]   [ # 41 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12390
Joined  04-29-2002

Thanks, I’ll add it. Wasn’t sure if anyone else had ever wanted that piece of functionality.

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 18 October 2008 05:49 AM   [ Ignore ]   [ # 42 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

Yes. Essentially the formatting options were added to allow a reasonable amount of flexibility, but nothing quite as flexible as what the query module can achieve, since that accepts and replaces tagdata. I’m beginning to think that a plugin to wrap the query module, with options to insert custom browser headers would offer everything csvee can, plus more, though perhaps not as easy to implement.

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 28 October 2008 09:31 AM   [ Ignore ]   [ # 43 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1728
Joined  03-26-2006

Has anyone had an issue exporting dates in a human-readable format with CSVee? We’re trying to export the entry date, but I know the client won’t know a timestamp from a hole in the wall. I tried something like this (simplified query):

{exp:csvee filename="file.csv" seperator="," query="SELECT date_format(entry_date, '%c/%e/%Y')
AS formatted_date, fullname, email FROM exp_freeform_entries WHERE entry_id != ''
AND form_name = 'specificForm' ORDER BY entry_date DESC"
}


No matter what I try, the SQL won’t work, and the date field returns empty.

SELECT date_format(entry_date, '%c/%e/%Y') AS formatted_date,
SELECT date_format(entry_date, '%c/%e/%Y') AS entry_date,
SELECT date_format(entry_date, '%c/%e/%Y'),


Is that SQL statement for mySQl 5 only or something? not sure why it wouldn’t work.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 29 October 2008 06:01 AM   [ Ignore ]   [ # 44 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006
mdesign - 28 October 2008 09:31 AM

Is that SQL statement for mySQl 5 only or something? not sure why it wouldn’t work.

It will work on 4.1. What server version are you building on, and have you tried the query through another tool? (phpmyadmin/ee query tab)

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 29 October 2008 08:52 AM   [ Ignore ]   [ # 45 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1728
Joined  03-26-2006

Looks like that site is on a PHP 4.4.8/mysql 4.1.22 server.

Just gave that query one more try through Navicat, and the column I’m trying to format returns “[Null]”.

SELECT entry_date,
date_format(entry_date, '%c/%e/%Y') AS formatted_date,
email
FROM exp_freeform_entries
ORDER BY entry_date DESC


resulted in:

1225305383  [Null]  email@address1.com
1225301519  [Null]  email
@address2.com
1218244116  [Null]  email
@address3.com
1217824199  [Null]  email
@address4.com


My other thought was to target the entry_date field and use PHP date() to format that field right in the plugin, but it doesn’t seem like should have to go there.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 29 October 2008 03:03 PM   [ Ignore ]   [ # 46 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

Yes of course, it’s a unix timestamp :|

try

SELECT entry_date,
date_format(from_unixtime(entry_date), '%c/%e/%Y') AS formatted_date,
email
FROM exp_freeform_entries
ORDER BY entry_date DESC

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 29 October 2008 04:57 PM   [ Ignore ]   [ # 47 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1728
Joined  03-26-2006

Daniel, thank you - that last query worked perfectly.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 06 November 2008 01:04 PM   [ Ignore ]   [ # 48 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  780
Joined  07-18-2006

Daniel - I have a SQL statement that will return results when run directly against the DB (in phpMyAdmin), but when I use your plug-in, nothing is downloaded. This is the only thing on the template, so it’s something in your plug-in it would seem?  I can’t figure it out - I’ve been looking at the plug-in and I can’t see any reason this wouldn’t work:

{exp:csvee query="SELECT
                 company_uid,
                FROM_UNIXTIME(entry_date, '%m/%d/%Y') AS `date`,
                company,
                 last_name,
                first_name,
                title,
                address,
                address_2,
                city,
                state,
                county,
                zip,
                phone,
                fax,
                email,
                url,
                contact_control,
                business_description,
                employees,
                category,
                member_discount,
                options,
                membership_level,
                REPLACE(donation, 'Other:', '') AS donation,
                donation_amount,
                'CC' AS `payment type`,
                approval_num,
                tags,
                member_to_member_communication,
                password,
                subscription_id AS `notes`
                
                FROM exp_freeform_entries
                WHERE form_name = 'update_info_form'
                ORDER BY entry_date
                DESC"
                
filename="update_submissions.csv"}

I have two other export templates that use that exact same code and just changes the “WHERE” clause, and they both work as well.  Any thoughts?  Could there be something in the results themselves that could be somehow tripping up the generation of the CSV?

Thanks…

Profile
 
 
Posted: 07 November 2008 01:24 PM   [ Ignore ]   [ # 49 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  780
Joined  07-18-2006

Edit - I’m still trying to track down exactly what’s going on, but it probably isn’t your extension. There’s a few other weird things happening

It does bring up another thing I was going to say though.  I’ve used this plug-in a few times and it’s great. A feature I’d find really useful would be a debug option - if your SQL throws an error or something doesn’t work, you could get the SQL statement itself and the MySQL error response.  Just a thought - I tend to need to debug my SQL statements and have to use another tool to see what actually happens if it’s not a good query.

Profile
 
 
Posted: 11 November 2008 05:32 PM   [ Ignore ]   [ # 50 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

Does this solve it?

File Attachments
pi.csvee.zip  (File Size: 3KB - Downloads: 14)
 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 12 November 2008 07:59 AM   [ Ignore ]   [ # 51 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  780
Joined  07-18-2006

That’s got it - thanks!  What was happening?

Profile
 
 
Posted: 16 November 2008 07:59 PM   [ Ignore ]   [ # 52 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

Danger Will Robinson!

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 17 November 2008 08:08 AM   [ Ignore ]   [ # 53 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  780
Joined  07-18-2006

Daniel - something else happens during CSV formation that was causing a Filemaker consultant to pull her hair out.  It adds an extra line at the beginning and end of the CSV. I modified (just for myself) the plug-in so it didn’t include a carrage return on the end, but didn’t quickly see where the beginning extra line was coming from (and it seemed like it wasn’t always there?).

Just thought I would mention it (I’m sure you’re just waiting around for things to do to this plug-in!)

Profile
 
 
   
3 of 3
3
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64939 Total Logged-in Users: 65
Total Topics: 81913 Total Anonymous Users: 37
Total Replies: 440330 Total Guests: 286
Total Posts: 522243    
Members ( View Memberlist )