Running and Exporting Email/Client id Reports

Hi All,

Can anyone please tell me - How do you get a report listing clients email addresses and the corresponding client i/d number and then supposing this can be dione, how do you then merge them into a spead sheet?

 

Thanks,

Jess

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Running and Exporting Email/Client id Reports

Jess - the raw SQL you need (at its most basic) is:

select party_id, description from contacts where arch_short_name = 'contact.email';

The above will extract every email address. A more targetted query is:

select c.party_id as id, c.description as email, e.name, e.description as address from contacts as c join entities as e on c.party_id=e.entity_id
where c.arch_short_name = 'contact.email' and e.arch_short_name='party.customerperson' and e.active=1;

which grabs only active customers and provides their names and addresses also.

Attached is a jrxml report file that incorporates the above. You can create a template that uses this (remember to make its TYPE=Report so that it will show up in the Reporting|Reports list). You can then run the report and click the Export button to get a CSV file that can be imported into a spreadsheet.

NOTE: while testing this, I found what I think is a bug in the export code -- see http://www.openvpms.org/forum/exported-csv-data-has-extra-fields

As a result, I adjusted the report not to include the address - and this generates a CSV file which happily imports into Excel. [Note that if you are wondering why the column header for the ID column is "CID" rather than "ID", its because of a bug/funny in Excel which causes it to be confused if the first column is named "ID".

AttachmentSize
clientEmailAddresses_NA.jrxml 2.11 KB

Re: Running and Exporting Email/Client id Reports

Hi Jess,

The customer marketing export report will do this (with other customer fields) as well.  Just load up into OpenVPMS and run with specified criteria and use export button to save as a spreadsheet.  You can then utilise the spreadsheet with Word or Open Office to doing letters, mailing labels etc. 

Cheers Tony

Syndicate content