Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: "any dropdown" in Advanced Search

  1. #1
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Thumbs up "any dropdown" in Advanced Search

    Hi there,

    I have two custom fields ("Car 1" and "Car 2" for example) for module Contacts of type DropDown. They use one dropdown list (cars_dom). Now I want to make a field in advanced search called "Any Car" with the same dropdown and search the two db fields.

    I'm looking at the wiki and tried with:

    PHP Code:
    'cars_all'=> array('query_type'=>'default','operator'=>'=','options'=>'cars_dom'), 
    in SearchDefs.php but with no luck.
    Any ideas?
    Thanks

    SugarCE 5.2.0e

  2. #2
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Default Re: "any dropdown" in Advanced Search

    Like a workaround:

    PHP Code:
    <?php
    $searchdefs 
    ['Contacts'] =
    array (
      
    'layout' =>
      array (
        
    'advanced_search' =>
          
    'car_1' =>
          array (
            
    'width' => '10%',
            
    'label' => 'LBL_ANY_CAR',
            
    'default' => true,
            
    'name' => 'car_1',
            
    'displayParams' => array(
                    
    'size' => '1',
            ),
          ),
    Then in SearchFields.php:
    PHP Code:
                    'car_1'=> array('query_type'=>'default','operator'=>'=','db_field'=>array('car_1','car_2')), 

  3. #3
    madhrishi is offline Senior Member
    Join Date
    Feb 2009
    Posts
    99

    Default Re: "any dropdown" in Advanced Search

    Hi Zaska,

    Great post and this is what i was looking for... Can you please explain more how to achieve this? I made the modifications in custom/module/my_module folder... With your steps i am not finding any field in the advanced search view... should i explicitly add a 'car_1' drop down? Pls let me know....

    Actually in the search view, i get a blank field with Label : LBL_ANY_CAR

    Thanks
    Last edited by madhrishi; 2009-07-11 at 10:40 AM.

  4. #4
    aprameya is offline Member
    Join Date
    Jun 2009
    Posts
    8

    Unhappy Re: "any dropdown" in Advanced Search

    Many ppl ask this question... no one answers
    Following threads raise the same question... but no solution...

    http://www.sugarcrm.com/forums/showthread.php?t=6229
    http://www.sugarcrm.com/forums/showt...ght=search+any
    http://www.sugarcrm.com/forums/showt...ght=search+any
    http://www.sugarcrm.com/forums/showt...ght=search+any
    http://www.sugarcrm.com/forums/showt...ght=search+any

    I have search the forums toooo much. Sugar team, kindly help.
    Last edited by aprameya; 2009-07-12 at 11:22 AM.

  5. #5
    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: "any dropdown" in Advanced Search

    Have a look at the Leads module metadata: modules/Leads/metadata.
    File SearchFields.php:
    PHP Code:
            'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')), 
    Create a new array element for a virtual field where you will set the db fields to be searched.

    File searchdefs.php:
    PHP Code:
                    array('name' => 'address_state''label' =>'LBL_STATE''type' => 'name'), 
    Add this virtual field into searchdefs.php, Sugar will render it according to type (name) template.

    The fiile searchdefs.php can be customized into custom/modules/Leads/metadata folder, but the SearchFields.php not, but you can create the file custom/modules/Leads/metadata/metafiles.php and set the path for the new SearchFields.php there. Have a look at the script modules/Contacts/metadata/metafiles.php

    Regards
    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.

  6. #6
    madhrishi is offline Senior Member
    Join Date
    Feb 2009
    Posts
    99

    Default Re: "any dropdown" in Advanced Search

    Thank You... That was some hope.... i managed to get a field in the search form... but it looks weird...

    I did the following at sugarcrm/custom/modules/Contacts/metadata

    sugarcrm/custom/modules/Contacts/metadata/Searchdefs.php

    Code:
    'car_c' => 
          array (
            'name' => 'car_c',
            'width' => '10%',
            'label' => 'LBL_THIS_CAR',
            'default' => true,
            'type' => 'enum',
            'options' => 'programlist_list',        
          ),
    sugarcrm/custom/modules/Contacts/metadata/Searchfields.php

    Code:
    'car_c'=> array('query_type'=>'default','operator'=>'=','db_field'=>array('field1_c','field2_c')),
    sugarcrm/custom/modules/Contacts/metadata/metafiles.php

    Code:
    $metafiles['Contacts'] = array(
    	'searchfields'	  =>    'custom/modules/Contacts/metadata/SearchFields.php',
     );
    This is what i got in the search form : Kindly help...

    A enum with no values.....
    Attached Images Attached Images  

  7. #7
    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: "any dropdown" in Advanced Search

    You need to create the dropdown programlist_list throught Admin -> Studio -> Dropdown Editor and also create the translation for LBL_THIS_CAR into an extended language for Contacts.

    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.

  8. #8
    madhrishi is offline Senior Member
    Join Date
    Feb 2009
    Posts
    99

    Default Re: "any dropdown" in Advanced Search

    Hi Andopes,

    Of course i created the drop down... field1_c and field2_c database fields are also instances of this dropdown ... Anything else that i am missing? Have i included the right contents in the files? Especially the metadata.php and Searchdefs.php ??

    Thanks

  9. #9
    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: "any dropdown" in Advanced Search

    At the search form sugar read the options from vardefs instead of from searchdefs.php, so you need to create the field in the extended vardefs as an non-db field:
    custom/Extension/modules/Contacts/Ext/Vardefs/vardefs.ext.php

    PHP Code:
    $dictionary['Contact']['fields']['car_c'] = array(
                
    'name' => 'car_c',
                
    'vname' => 'LBL_THIS_CAR',
                
    'type' => 'enum',
                
    'options' => 'programlist_list',
                
    'len' => '100',
    ); 
    Go to Admin -> Repair -> Rebuild Extensions

    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.

  10. #10
    madhrishi is offline Senior Member
    Join Date
    Feb 2009
    Posts
    99

    Default Re: "any dropdown" in Advanced Search

    Now i have the field displayed properly on the search form... But its failing to retrieve any records...
    Below are the contents of the files :

    custom/modules/Forse_Contactssearch/metadata/SearchFields.php

    Code:
                'programname_c'=> array('query_type'=>'default','operator'=>'=','options'=>'program_list','db_field'=>array('prog1_c','prog2_c')),
    custom/modules/Forse_Contactssearch/metadata/searchdefs.php

    Code:
          'programname_c' => 
          array (
            'name' => 'programname_c',
            'width' => '10%',
            'label' => 'LBL_THIS_PROGRAM',
            'default' => true,
            'type' => 'enum',
            'options' => 'program_list',        
          ),
    custom/modules/Forse_Contactssearch/metadata/metafiles.php
    Code:
    $module_name = 'Forse_Contactssearch';
     $metafiles[$module_name] = array(
    	'searchfields'	  =>    'custom/modules/'. $module_name. '/metadata/SearchFields.php',
     );
    ?>
    custom/Extension/modules/Forse_Contactssearch/Ext/Vardefs/vardefs.ext

    Code:
    <?php
    $dictionary["Forse_Contactssearch"]["fields"]["programname_c"] = array( 
                'name' => 'programname_c', 
                'vname' => 'LBL_THIS_PROGRAM', 
                'type' => 'enum', 
                'options' => 'program_list',
                'source' => 'non-db',
                'len' => '100', 
    );
    ?>
    Attached Images Attached Images  

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sort "Assigned to" on Accounts/Advanced Search page
    By umayxa3 in forum Developer Help
    Replies: 0
    Last Post: 2009-02-06, 08:37 PM
  2. Advanced search "NOT" filter
    By psdavec in forum Feature Requests
    Replies: 9
    Last Post: 2008-08-01, 10:56 PM
  3. Adding "Member Of:" to advanced search.
    By spectheintro in forum Help
    Replies: 2
    Last Post: 2007-11-16, 03:20 PM
  4. Replies: 1
    Last Post: 2006-06-16, 03:35 AM
  5. Replies: 6
    Last Post: 2005-01-26, 08:53 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
  •