CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Using tokens in export mappings
Pages: [1]

Author Topic: Using tokens in export mappings  (Read 797 times)

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Using tokens in export mappings
August 30, 2011, 09:25:54 am
Currently it is possible to use custom calculated fields to get arbitrary calculated data out during an export. It is also possible to export data from CiviCRM, insert fields into each row (eg a constant applicable for all rows), and then import into a different application.

I'm wondering if it would be possible and of general interest to support tokens as well as fields as objects during exports. From a UI perspective, the pick list on something like Find Contributions, select contributions for action, Export Contributions, Go, .... Select Fields to Export (step 3 of 3) (http://drupal.demo.civicrm.org/civicrm/contribute/search?_qf_Map_display=true) would include tokens as well as contact and contribution fields. From a db perspective, I think (but haven't verified) the internal token name could go in civicrm_mapping_field.name without namespace conflict.

A big benefit for me for a current project is that this would greatly ease the regular transfer of data to an external application (http://wiki.civicrm.org/confluence/display/CRM/Direct+Debit+and+Direct+Credit+-+Monthly+Batches). It would also allow header and footer records on fixed length export files to be produced using field mappings and yet easily contain things like the number of detail records, the total of a certain column, etc.

Comments?
« Last Edit: August 30, 2011, 09:28:57 am by JoeMurray »
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using tokens in export mappings
September 04, 2011, 04:23:06 am
Joe - Would this mean any custom mail merge tokens ( created using the hook "hook_civicrm_tokens" )  would be available during an export?  If so, I think this is a great idea. 
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

JoeMurray

  • Administrator
  • Ask me questions
  • *****
  • Posts: 578
  • Karma: 24
    • JMA Consulting
  • CiviCRM version: 4.4 and 4.5 (as of Nov 2014)
  • CMS version: Drupal, WordPress, Joomla
  • MySQL version: MySQL 5.5, 5.6, MariaDB 10.0 (as of Nov 2014)
Re: Using tokens in export mappings
September 05, 2011, 05:59:12 am
Yes, that's the general idea.
Co-author of Using CiviCRM https://www.packtpub.com/using-civicrm/book

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Using tokens in export mappings
September 05, 2011, 06:09:13 am
Until the context is properly handled to token (ie. so you can avoid to calculate them no matter if they are used or not), I'd rather avoid to invoke them from yet another place.

Unless you have a better idea to avoid calculate them when they aren't used?

Otherwise, a token likely means one token per row, ie. loads of requests for an export. Wouldn't something like lobo's latest hook be a better solution?

http://civicrm.org/blogs/lobo/introducing-hookcivicrmsearchcolumns-modify-search-results-meet-your-needs

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Using tokens in export mappings

This forum was archived on 2017-11-26.