Results 1 to 3 of 3

Thread: Using get_team_array() in a custom query

  1. #1
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Using get_team_array() in a custom query

    Hi,

    I want to use the returned array from get_tem_array() in a custom query. In this test the array contain 33 records, that I want to use in the where clause of my query

    Select * from table where team_name IN (my returned array)

    How do I do this?

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  2. #2
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: Using get_team_array() in a custom query

    Something like this:

    PHP Code:
    $team_name_list '';
    $team_id_list '';
    foreach(
    get_team_array() as $id=>$name){
       if (
    $team_id_list == ''){
          
    $team_id_list "'" $id "'";
          
    $team_name_list "'" $name "'";
       } else {
          
    $team_id_list .= ",'" $id "'";  
          
    $team_name_list = .",'" $name "'";
       }

    and then

    $qry="Select * from table where team_id IN (".$team_id_list.")"

    or

    $qry="Select * from table where team_name IN (".$team_name_list.")"

    ???
    Harald Kuske
    Pre-Sales Engineer Central Europe

    SUGARCRM Deutschland GmbH
    Erika-Mann-Str. 53, 80636 Munich, Germany
    Email: hkuske@sugarcrm.com
    Home: http://www.sugarcrm.com


  3. #3
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Using get_team_array() in a custom query

    That is perfect, thank you very much

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Custom Query
    By dvelguru in forum Feature Requests
    Replies: 1
    Last Post: 2010-01-03, 05:15 PM
  2. Custom query for list view in custom module
    By precar in forum Developer Help
    Replies: 3
    Last Post: 2009-06-15, 04:01 AM
  3. Custom on custom query view....
    By mcnudox in forum Developer Help
    Replies: 1
    Last Post: 2009-03-29, 03:25 PM
  4. Custom query on custom view (List)
    By jasv in forum Developer Help
    Replies: 4
    Last Post: 2009-02-09, 10:36 AM
  5. Custom query in Custom Dashboard module
    By tbivans in forum Developer Help
    Replies: 11
    Last Post: 2007-03-05, 07:18 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
  •