Results 1 to 3 of 3

Thread: Search for a range?

  1. #1
    gerald29 is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    34

    Default Search for a range?

    Hello all,
    is there a way to search for a range of results? For instance, i have a field called employee count, can i search for all companies with a range of 50-100 employees? is there a syntax i can use for this? i have tried a few with no luck
    SugarCRM 5.1.0c
    Windows Server 2003 R2
    XAMPP Installation
    Apache / MySQL

  2. #2
    roblaus's Avatar
    roblaus is offline Sugar Community Member
    Join Date
    Dec 2006
    Location
    Vienna / Austria
    Posts
    2,850

    Default Re: Search for a range?

    Check this out: http://www.sugarforge.org/projects/enhancedsearch/

    If this isn't what you're after you may want to look at Jasper or smthg similar.

    rgds
    __________________________
    Robert Laussegger
    http://www.iscongroup.net

    Bei Fragen: support@iscon.at
    Die deutschen Sprachdateien für SugarCRM und das deutsche Handbuch gibt es hier: http://goo.gl/kPsAz
    Ab sofort auch mit 6.4.2

  3. #3
    dlorenzetti's Avatar
    dlorenzetti is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    São Paulo, Brasil
    Posts
    189

    Default Re: Search for a range?

    Hi gerald29,

    You can do that in modules/<MODULE_NAME>/ListView.php, after Sugar defines the $where_clauses.
    Folow is an example:

    PHP Code:

        
    if (isset($_REQUEST['date_begin'])) $date_begin $_REQUEST['date_begin'];
        if (isset(
    $_REQUEST['date_end'])) $date_end $_REQUEST['date_end'];


        
    $where_clauses generate_search_where($searchFields,$_REQUEST,$seedProposal,true,"Proposals");
        
        if(isset(
    $date_begin) && $date_begin != ""){ 
            
    $date_begin_dbformat $timedate->swap_formats($date_begin$timedate->get_date_format(), $timedate->dbDayFormat);
            
    array_push($where_clauses"proposals.date >= '".PearDatabase::quote($date_begin_dbformat)."'");
        }
        if(isset(
    $date_end) && $date_end != ""){ 
            
    $date_end_dbformat $timedate->swap_formats($date_end$timedate->get_date_format(), $timedate->dbDayFormat);
            
    array_push($where_clauses"proposals.date <= '".PearDatabase::quote($date_end_dbformat)."'");
        } 

    In this case I do the range search for date field in Proposal Module. you going to do for your module.employees.

    I hope this helps.
    Diego Lorenzetti
    Lampada Global Services - Open Source Solutions
    Phone: +55 11 3237-3110
    Email: equipe@lampadaglobal.com
    Site: www.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.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Enhanced Search Plugin
    By kenshiro in forum Downloads
    Replies: 71
    Last Post: 2010-08-24, 02:45 PM
  2. Search View
    By cheku0228 in forum Developer Help
    Replies: 3
    Last Post: 2008-08-05, 11:36 AM
  3. Replies: 6
    Last Post: 2007-11-22, 01:31 PM
  4. Search a range
    By mingwu in forum Developer Help
    Replies: 2
    Last Post: 2006-05-02, 01:37 AM

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
  •