Results 1 to 4 of 4

Thread: function create_export_query

  1. #1
    mcgiver is offline Member
    Join Date
    Oct 2008
    Posts
    5

    Default function create_export_query

    Hello sugar experts!
    I want to expand the export command on my customized module (created by module builder). I have a relate field linking to accounts module. How can I export the e-mail address of linked account from my customized module?
    I have found I have to create the function create_export_query, but I do not know how to do this SQL query.

    Any suggestions?

    Thanks
    Mcgiver

  2. #2
    mcgiver is offline Member
    Join Date
    Oct 2008
    Posts
    5

    Default Re: function create_export_query

    anyone can help me?

  3. #3
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: function create_export_query

    Hi Mcgiver


    PHP Code:
    SELECT {$this->table_name}.*, {$this->table_name}_cstm.*, ea.email_address
    FROM 
    {$this->table_name}
    LEFT JOIN {$this->table_name}_cstm ON {$this->table_name}.id = {$this->table_name}_cstm.id_c
    LEFT JOIN email_addr_bean_rel 
    AS eabr ON {$this->table_name}.id eabr.bean_id AND ea.bean_module = {$this->module_dir}
    INNER JOIN email_addresses AS ea ON eabr.email_address_id ea.id AND ea.primary_address 1
    WHERE 
    {$this->table_name}.deleted AND eabr.deleted AND ea.deleted 
    Adapt this query according to current query on the function and according to your needs.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  4. #4
    mcgiver is offline Member
    Join Date
    Oct 2008
    Posts
    5

    Default Re: function create_export_query

    Hello andopes, thank you very much for your help.

    I have my module called "ASK_test".
    My file "ASK_test.php":

    require_once('modules/ASK_test/ASK_test_sugar.php');
    class ASK_test extends ASK_test_sugar {

    function ASK_test(){
    parent::ASK_test_sugar();
    }
    }

    ... and this is my ASK_test_sugar.php:

    class ASK_test_sugar extends Basic {
    var $new_schema = true;
    var $module_dir = 'ASK_test';
    var $object_name = 'ASK_test';
    var $table_name = 'ask_test';
    var $importable = false;
    var $id;
    var $name;
    var $date_entered;
    var $date_modified;
    var $modified_user_id;
    var $modified_by_name;
    var $created_by;
    var $created_by_name;
    var $description;
    var $deleted;
    var $created_by_link;
    var $modified_user_link;
    var $assigned_user_id;
    var $assigned_user_name;
    var $assigned_user_link;
    var $azienda;

    function ASK_test_sugar(){
    parent::Basic();
    }

    function bean_implements($interface){
    switch($interface){
    case 'ACL': return true;
    }
    return false;
    }
    }

    "Azienda" is the relate field to an existing account.

    Can you help me finding out what to add to ASK_test.php file? (in order to show email address of the account in extract function?)

    Thanks again for your time

    McGiver

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to create a function for a computed field
    By elvinjoe in forum Developer Help
    Replies: 1
    Last Post: 2008-07-21, 12:18 PM
  2. add a function to a module
    By arffup in forum Developer Help
    Replies: 4
    Last Post: 2008-03-24, 08:59 PM
  3. Replies: 0
    Last Post: 2007-08-08, 02:47 PM
  4. Implement Print Function on EditView
    By emillion in forum Developer Help
    Replies: 7
    Last Post: 2007-06-28, 05:28 PM
  5. Row_number is not a recognized function
    By theoracleprodigy in forum Help
    Replies: 4
    Last Post: 2007-04-10, 04:58 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
  •